SSHFS lets you mount remote directories over SSH and access them as if they were stored locally on your system. This is useful when managing files across multiple servers, backing up data or working with remote development environments.
You will install SSHFS, mount a remote directory and configure automatic mounting at boot. Once complete, you can access remote files through your local filesystem without repeated SSH connections.
SSHFS must be installed before you can mount remote directories. The installation command varies depending on your distribution’s package manager.
For Debian-based systems (Ubuntu, Debian, Linux Mint):
sudo apt update
sudo apt install sshfs
For RHEL-based systems (Fedora, CentOS, AlmaLinux, Rocky Linux):
sudo dnf install sshfs
The package manager downloads and installs SSHFS along with its dependencies. You can now mount remote directories over SSH.
Remote directories need a local directory to mount to. You will create this mount point before establishing the connection.
mkdir /backup to create a directory called backup in your root filesystem. You can use any name and location that suits your workflow.ls -ld /backup to confirm the directory was created successfully. This directory will serve as the access point for your remote files.You will now connect to the remote server and mount its directory to your local mount point. This makes the remote files accessible through your local filesystem.
sshfs root@192.168.1.10:/home /backup replacing root with your remote username, 192.168.1.10 with the remote server’s IP address, /home with the remote directory path and /backup with your local mount point.ls /backup to view the contents of the remote directory. You can now read, write and manage these files as if they were stored locally.If you encounter connection issues, you may need to disable strict host key checking for automated mounting scenarios.
Adding an entry to /etc/fstab makes the remote directory mount automatically when your system starts. This prevents you from manually mounting the directory after each reboot.
sudo nano /etc/fstab to open the filesystem table configuration file in a text editor.sshfs#root@192.168.1.10:/home /backup fuse.sshfs defaults 0 0 replacing the username, IP address and paths with your actual values.Ctrl+X, then Y, then Enter to save your changes and exit the editor.sudo mount -a to mount all filesystems listed in fstab. This verifies your entry is correct before rebooting.sudo reboot to restart your server. After the system comes back online, the remote directory will be mounted automatically.Connection timeouts occur when the remote server is unreachable or SSH is not running on the expected port.
ping 192.168.1.10 replacing the IP address with your remote server’s address.ssh root@192.168.1.10 to test a direct SSH connection.-p port_number after the hostname.Permission errors happen when your SSH key has incorrect permissions or the remote user lacks access to the target directory.
chmod 600 ~/.ssh/id_rsa to restrict access to your private key.ls -ld /home replacing /home with your target directory.~/.ssh/authorized_keys on the remote system.This error appears when processes are still using the mounted directory, preventing you from unmounting it.
lsof /backup replacing /backup with your mount point path.sudo umount -l /backup which performs a lazy unmount, detaching the filesystem immediately.Your remote directory is now mounted via SSHFS and accessible through your local filesystem. You installed SSHFS, created a mount point, established the connection and configured automatic mounting at boot. Remote files appear locally without repeated SSH connections.
Review your mount configuration after the next reboot to confirm it mounts automatically. Our VPS hosting provides full SSH access for managing remote filesystems and server configurations.
Get scalable resources with our VPS hosting with root access and optional software.
Get VPS HostingPerfect for websites and small businesses unlimited bandwidth with cPanel hosting.
Get cPanel Hosting