Beta 42

Research and Development

Menu

Mount Remote Directories over SSH

SSHFS (SSH Filesystem) is a filesystem client based on FUSE for mounting remote directories over an SSH connection. SSHFS is using the SFTP protocol, which is a subsystem of SSH and it is enabled by default on most SSH servers.

SSHFS does not require any additional configuration on the server side. To use SSHFS only SSH access to the remote server is required.

Install SSHFS

SSHFS is available from the default Ubuntu and Debian repositories. Update the packages index and install the sshfs client:

$ sudo apt update
$ sudo apt install sshfs

Mount a Remote File System

To mount a remote directory the SSH user needs to be able to access it. The SSHFS mount command takes the following form:

$ sshfs [user@]host:[remote_directory] mountpoint [options]

For example, to mount the home directory of a user george on a remote host with IP address of 72.168.32.11:

$ sshfs george@72.168.32.11/home/george /local/mountpoint

To permanently mount the remote directory edit the local machine's /etc/fstab file an add a new mount entry, using fuse.sshfs as the filesystem type:

$ sshfs#user@host:/remote/dir /local/mountpoint fuse defaults,user,uid=user,gid=user,allow_other,
  IdentityFile=/path/id_rsa,port=port  0 0

Unmount a Remote File System

To detach a mounted file system, use either the umount or fusermount command followed by the directory where it has been mounted (mount point):

$ fusermount -u /local/mountpoint
$ umount /local/mountpoint