How To Use SSHFS to Mount Remote File Systems Over SSH

SSHFS is a filesystem client to mount and interact with directories and files located on a remote server or workstation over a normal ssh connection.

To Install SSHFS on CentOS, run following command:

yum install sshfs

To mount any remote file system, first create a mounting point.

mkdir /mnt/remote-system

To mount remote file system (say which IP address is 192.168.0.200), run following command.

sshfs user-name@192.168.0.200:/ /mnt/remote-system

You remote file system will be mounted under /mnt/remote-system. You will same file permission on remote file system as user (user-name) is having, as you are connected with this login.

How To Use SSHFS to Mount Remote File Systems Over SSH:

To Use SSHFS to Mount Remote File Systems Over SSH, you use “sftp_server” option of SSH configuration. For this ensure on remote file system, you enabled “sftp_server”, which is there by default.

On Remote File System:
# cat /etc/ssh/sshd_config
..
..
# override default of no subsystems
Subsystem       sftp    /usr/libexec/openssh/sftp-server
..
..

Now, on client run following command to mount remote file system over sudo.

sshfs user-name@192.168.0.200:/ /mnt/remote-system/ -o sftp_server="/usr/bin/sudo /usr/libexec/openssh/sftp-server"

You work on /mnt/remote-system/ as sudo access of user (user-name).

One thought on “How To Use SSHFS to Mount Remote File Systems Over SSH

Leave a Reply

Your email address will not be published.