Mount Other Server's Drive through SSH on Centos 7 with Different Port Using SSHFS

Here are the steps to do so:

We can easily mount a remote file system by using SSHFS.

1. Enable the EPEL repo

We will need to install a few packages that are not available in the standard CentOS repository. In order to do this, 
yum install epel-release -y

2. Install FUSE and SSHFS packages

SSHFS uses FUSE (Filesystem in Userspace). Install the required packages:
1yum install fuse sshfs
yum install \*sshfs\*

 3. Load the FUSE module

1modprobe fuse
Confirm that the FUSE module is loaded:
1lsmod | grep fuse
2fuse                   84368  2
(Optional) Make sure the FUSE module is loaded upon a reboot:
1echo "modprobe fuse" >> /etc/rc.local

 4. Using SSHFS

Once the FUSE module is loaded, we can finally mount our remote partition using SSHFS:
1sshfs user@remote_host:/remote_directory /local_mount_partition
2sshfs root@1.2.3.4:/scripts /mnt
Note: SSHFS is not recommended for production, distributed file-systems. NFS is a better option, however, SSHFS can still be quite useful.

With IP, it should be as:

sshfs -p 25415 -C root@12.152.152.21:/home/ /backup/remote

Post a Comment

0 Comments