Setting up SSHFS on CentOS 6 64-bit


resolved
Public

SSHFS can be used to mount directories from one server to another securely over the SSH protocol.  This can be especially useful for our protected storage servers can is much better for sensitive data than NFS.  This guide is for CentOS 6 x86_64 (64-bit).

Enable FUSE

Allow for fuse by logging into the VPSGrid control panel, selecting Filesystems and Enable FUSE.

Enable EPEL Repo

rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Install FUSE and SSHFS

yum install fuse sshfs

Mount a remote directory to a local directory

mkdir /mnt/sshfs

sshfs user@123.123.123.123:/remotedir /mnt/sshfs

Replace /mnt/sshfs with the local directory you wish to use, and replace /remotedir with the directory on the remote server you wish.

Other tips

Unmounting a FUSE mount

fusermount -u /mnt/path

ID Mapping and User Access

FUSE will by default mount the directory as root, disabling access to other users.  To allow other users to access the mount, you can mount SSHFS with the ‘allow_user’ option:

sshfs -o allow_other user@123.123.123.123:/remotedir /mnt/sshfs

To map the mount to a specific user.  You can mount with the idmap=user option.  Note that the user must exist on both the remote and the local system.
sshfs -o idmap=user admin@123.123.123.123:/home/admin /home/admin

If the user is different on the local system, you can specify the user. For example on the remote system, the user is admin and the local system, the user is admin2.

sshfs -o idmap=user,User=admin2 admin@123.123.123.123:/home/admin /home/admin2

 

Please login or Register to Submit Answer