How to mount remote directories with SSHFS

By Angus Published 18 April 2025 Updated 4 March 2026 5 min read

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.

Before you begin

  • You need SSH access to both the local and remote server.
  • We recommend setting up SSH key authentication to avoid repeated password prompts.

Install SSHFS on your system

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.

Create a local mount point

Remote directories need a local directory to mount to. You will create this mount point before establishing the connection.

  1. Create the mount directory.
    Run mkdir /backup to create a directory called backup in your root filesystem. You can use any name and location that suits your workflow.
  2. Verify the directory exists.
    Run ls -ld /backup to confirm the directory was created successfully. This directory will serve as the access point for your remote files.

Mount the remote directory

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.

  1. Mount the remote directory.
    Run 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.
  2. Enter your SSH password.
    When prompted, enter the password for the remote user account. The remote directory mounts to your local system after successful authentication.
  3. Access the remote files.
    Run 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.

Configure automatic mounting at boot

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.

  1. Open the fstab file.
    Run sudo nano /etc/fstab to open the filesystem table configuration file in a text editor.
  2. Add the mount entry.
    Add this line at the end of the file: sshfs#root@192.168.1.10:/home /backup fuse.sshfs defaults 0 0 replacing the username, IP address and paths with your actual values.
  3. Save and close the file.
    Press Ctrl+X, then Y, then Enter to save your changes and exit the editor.
  4. Test the configuration.
    Run sudo mount -a to mount all filesystems listed in fstab. This verifies your entry is correct before rebooting.
  5. Reboot your system.
    Run sudo reboot to restart your server. After the system comes back online, the remote directory will be mounted automatically.

Troubleshooting

Connection timeout

Connection timeouts occur when the remote server is unreachable or SSH is not running on the expected port.

  • Verify the remote server is online by running ping 192.168.1.10 replacing the IP address with your remote server’s address.
  • Check that SSH is running on the remote server by running ssh root@192.168.1.10 to test a direct SSH connection.
  • If SSH runs on a non-standard port, specify it in your mount command using -p port_number after the hostname.

Permission denied

Permission errors happen when your SSH key has incorrect permissions or the remote user lacks access to the target directory.

  • Set correct SSH key permissions by running chmod 600 ~/.ssh/id_rsa to restrict access to your private key.
  • Verify the remote user has read access to the directory by logging in via SSH and running ls -ld /home replacing /home with your target directory.
  • Check that your SSH key is properly configured on the remote server by reviewing ~/.ssh/authorized_keys on the remote system.

Mount point busy

This error appears when processes are still using the mounted directory, preventing you from unmounting it.

  • Identify processes using the mount point by running lsof /backup replacing /backup with your mount point path.
  • Close any applications or terminal sessions accessing files in the mounted directory.
  • Force unmount if necessary by running sudo umount -l /backup which performs a lazy unmount, detaching the filesystem immediately.

Wrapping up

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.

Need more power?

Get scalable resources with our VPS hosting with root access and optional software.

Get VPS Hosting

Starting something new?

Perfect for websites and small businesses unlimited bandwidth with cPanel hosting.

Get cPanel Hosting