Ever wanted to mount a remote directory? SSHFS is a file system that is used to mount remote directories through an SSH connection. This is useful if for example you have a backup server somewhere but wish to utilize it on another server within a specified directory.
In this tutorial, we will show you how!
How to install SSHFS on Ubuntu / Debian
sudo apt update
sudo apt install sshfs
How to install SSHFS on Windows
WinFsp and SSHFS-Win are the two packages that Windows users must have to perform the installation.
How to install SSHFS on CentOS
sudo yum install sshfs
How to install SSHFS on macOS
To install SSHFS, macOS user can get the FUSE and SSHFS packages using osxfuse site or through Homebrew:
brew cask install osxfusebrew install sshfs
How to mount a remote file system
You must be able to access the remote directory to be able to mount a remote directory. The SSHFS mount command goes like this:
sshfs [[email protected]]host:[remotedirectory] mountpoint [options]
You will first need to create a directory on the server you wish to mount the directory on. That will act as a mount point, the location can be whatever you want, for example:
The following command can then be used to mount the remote directory:
sshfs [email protected]:/storage1 /remotemount
In the above command, replace 220.127.116.11 with the remote server IP address.
After that, you shall be asked to put in the password of the user. This will enable you to use the files and the directories that are present on a remote server in such a way as if you were interacting with local files. You can make changes to the files and you can also create new files and directories.
Want to mount the remote directory permanently? If the local machine’s /etc/fstab file is edited and a new mount entry is added then it is possible to mount the remote directory permanently (upon reboot).
Looking for a Linux VPS? Consider RackNerd’s VPS offers here.