Ssh Sync Folder

Rsync -avz -e ssh [email protected]:camera/ camera/ This will copy all files from the Pi's camera folder to your computer's new camera folder. In order to keep the folders in sync, run this command in cron. The key points to remember during remote sync comparing local sync is that we will need to change default.rsync to default.rsyncssh to enable rsync over ssh, and we should replace the 'target' variable with the 'host' and 'targeted' variables.

If you do any type of serious web or application development, you’re certainly used to working with remote servers and networked systems. You work locally, create test cases and do some kind of qa before deploying to the live system. But what if your qa / test system is also remotely? Wouldn’t it be nice if you could just work as if your files were local and have changes sync automatically?

Mount remote folder with ssh using sshfs makes it possible. Be careful as all changes are reflected on your remote server immediately and without warning. If you’re often working with remote servers, directories and files, then you know how annoying it can become to constantly sync your content using ftp, ssh, sftp or some other method.

Following are the steps necessary to accomplish this:

Install sshfs

This will also install fuse-utils and libfuse2, which are required for sshfs to work properly.

Create a folder to serve as mount location

Add your user account to the group

Your account will need the necessary access privileges for sshfs. After this command, you will need to logout and log back in for the changes to take effect.

Mount the remote filesystem

Now mount the location using the following syntax: sshfs [email protected]:/remote-folder local-mount

That’s it, you should now have a local folder with all the files from the remote location. You can work with them as if they’re local and see the effect on your remote location in real time. Keep in mind though that any mishap or coding error will be reflected immediately as well.

Ssh Sync Folder Free

  1. Thanks for the instructions. Really helpful.
    Btw, can you use subversion using sshfs mount?

Leave a Reply

Prerequisites

Ssh Sync Folders

  • A ssh server should run on a remote host, since PyCharm runs remote interpreter via ssh-session.

  • If you want to copy your sources to a remote computer, create a deployment configuration, as described in the section Create a remote server configuration.

Configuring remote Python interpreter via SSH credentials

Ssh Sync Folder Download

Create a new a remote Python interpreter via SSH credentials

  1. Ensure that you have downloaded and installed Python on your computer.

  2. Do one of the following:

    • Click the Python Interpreter selector and choose Add Interpreter.

    • Press Ctrl+Alt+S to open the project Settings/Preferences and go to Project <project name> Python Interpreter. Then click the icon and select Add.

  3. In the left-hand pane of the Add Python Interpreter dialog, click SSH Interpreter.

  4. In the right-hand pane select New server configuration, then specify server information (host, port, and username).

  5. In the next dialog window, provide the authentication details to connect to the target server.

    Select Password or Key pair (OpenSSL or PuTTY) and enter your password or passphrase. If Key pair (OpenSSL or PuTTY) is selected, specify:

    • Private key file: location of the file with a private key

    • Passphrase: similar to a password, it serves to encrypt the private key.

    The RFC 4716 format for OpenSSH keys is not supported by PyCharm. See the workaround.

    Click Next to proceed with the final configuration step.

  6. In the next dialog window, verify the path to the desired Python interpreter. You can accept default, or specify a different one. You have to configure the path mappings between your local project and the server. To do that, click next to the Sync folders field and enter the path to the local project folder and the path to the folder on the remote server.

    You can also select the lowest checkbox to enable automatic upload of the local changes to the remote server.

  7. Select the Execute code using this interpreter with root privileges via sudo checkbox to run an SSH interpreter using sudo. The root privileges will be enabled only for launching the remote interpreter. Files will be copied to the remote server with your current user privileges.

  8. Click Finish to complete adding an interpreter.

Create a new a remote Python interpreter using an SSH configuration

Sync
  1. Ensure that you have downloaded and installed Python on your computer.

  2. Do one of the following:

    • Click the Python Interpreter selector and choose Add Interpreter.

    • Press Ctrl+Alt+S to open the project Settings/Preferences and go to Project <project name> Python Interpreter. Then click the icon and select Add.

  3. In the left-hand pane of the Add Python Interpreter dialog, click SSH Interpreter.

  4. In the right-hand pane Existing server configuration and choose any available SSH configuration from the list.

    You can also create a new SSH configuration in the SSH Configurations dialog.

    Click and fill the required fields. Once done, the newly created SSH configuration will appear in the list of available configurations. It will also become available in the SSH Deployment Configurations settings.

    Click Next to continue configuring an interpreter.

  5. In the next dialog window, verify the path to the desired Python interpreter. You can accept default, or specify a different one. You have to configure the path mappings between your local project and the server. To do that, click next to the Sync folders field and enter the path to the local project folder and the path to the folder on the remote server.

    You can also select the lowest checkbox to enable automatic upload of the local changes to the remote server.

  6. Select the Execute code using this interpreter with root privileges via sudo checkbox to run an SSH interpreter using sudo. The root privileges will be enabled only for launching the remote interpreter. Files will be copied to the remote server with your current user privileges.

  7. Click Finish to complete adding an interpreter.

Ssh Sync Files

In case of adding an interpreter as a root user, you will be asked to provide your password.

Select Remember to keep using the password for this interpreter even you restart PyCharm. The interpreters added with root privileges are marked with sudo in the list of the available interpreters.