SSHFS (Secure SHell FileSystem) is a file system client that allows you to mount a remote file system over an SSH connection. It allows you to access and manipulate files on a remote server as if they were local files on your own computer.

To use SSHFS, you will first need to have an SSH client and the FUSE (Filesystem in Userspace) library installed on your local machine. On most Linux distributions, these packages are available in the default package repositories and can be installed using the package manager (e.g. apt-get, yum)

  1. sudo apt install sshfs

 

  1. sudo yum install sshfs

Once you have these packages installed, you can use the sshfs command to mount a remote file system. The basic syntax of the command is:

sshfs user@host:/path/to/remote/directory /path/to/local/mountpoint

For example, to mount the home directory of a user "example" on a remote host "example.com" to the local directory "/mnt/example", you would use the command:

sshfs example@example.com:/home/example /mnt/example

You will be prompted for the password of the remote user, and the remote file system will be mounted at the specified local mount point.

You can unmount the remote file system by using the fusermount -u command followed by the local mount point:

fusermount -u /mnt/example

You can also use the -o option to specify other options for the mount, such as the ssh port number, ssh key location or options to mount with read-only or allow_other option to allow other users to access the mounted filesystem.

sshfs -o port=2222,IdentityFile=~/.ssh/id_rsa,allow_other 
user@host:/path/to/remote/directory /path/to/local/mountpoint

Overall SSHFS is a convenient way to access remote file systems over an SSH connection. It allows you to work with remote files as if they were local, and can be a useful tool for remote file management, backups, and more.

Previous Post Next Post