This is a quick tip for users that need to move files from a Linux or Windows computer, to another remote Linux system, without installing samba or a ftp server. The file transfer is done through SSH so it’s secured.

Mounting a SSH directory in Linux

Generate a RSA 2048bit public/private key pair (press enter to all prompts):

ssh-keygen

Copy the public key to the remote server:

ssh-copy-id -i username@ssh.server.ip

Install sshfs

sudo apt-get install sshfs
or
sudo yum install sshfs

Create a directory for remote connection:

mkdir ~/remote/

Mount it:

sshfs username@ssh.server.ip:/home/username ~/remote/

That’s it! Chech it with:

ls ~/remote/

Use your file manager or console commands to upload/download files. When you’re done, umount it with:

fusermount -u ~/remote/

 

Mounting a SSH directory in Windows

I’ve tested this on Windows 8 which needed a bit of compatibility tweaks. Download and install win-sshfs. For Windows 8, before installing, set the compatibility mode to Windows 7:

Win SSHFS Windows 8

Before running it, go to its folder in ‘Program Files’ and set the compatibility mode for the executable as well:

Win SSHFS Windows 8

Open it and fill in the login details for your remote server:

Win SSHFS Windows 8

Press Mount. You should now have a new drive in your computer. Umount it from the sshfs dialog.

Win SSHFS Windows 8

Have fun!

Quick tip: Mounting a remote Linux folder in Windows and Linux over SSH
Tagged on: