How to Install SSHFS on Centos/RHEL/Ubuntu


Install SSHFS on Centos/RHEL/Ubuntu

** What is SSHFS?

SSHFS is a filesystem based on the SSH File Transfer Protocol (SFTP). On remote side we just need to install SSH server, Since most of SSH servers already support this, there are nothing to do on remote server except installing SSH server. On client side we need to install fuse sshfs packages to mount remote filesystem. Newer version of SSHFS uses FUSE.
We Can user it as Alternative of NFS.

** Features of SSHFS:

1. Based on FUSE (Best userspace filesystem framework for linux)
2. Multithreading: more than one request can be on it’s way to the server
3. Allowing large reads (max 64k)
4. Caching directory contents

** Requirement:

1. 2 Centos/Ubuntu Server
2. SSH Key Authentication on the Servers


Step 1: Stop the IPTables and Selinux, and Update the Date Time on the Servers and SSH Authentication on the Servers:

# service iptables stop
# chkconfig iptables off

# vi /etc/sysconfig/selinux

SELINUX=disabled ###(Change enabled to disabled)

--- save & quit (:wq) ---

On Server 1:
# ssh-keygen -t rsa (Enter 3 Times)
# ssh-keygen -t dsa (Enter 3 Times)
# cd /root/.ssh
# cat id_rsa.pub >>authorized_keys
# cat id_dsa.pub >>authorized_keys

On Server 2:
# ssh-keygen -t rsa (Enter 3 Times)
# ssh-keygen -t dsa (Enter 3 Times)
# cd /root/.ssh
# cat id_rsa.pub >>authorized_keys
# cat id_dsa.pub >>authorized_keys

** Now Open the authorized_keys file on both Server and Paste the Server 1's Key to Server 2's authorized_keys File and vice-versa.

# service ntpd restart
# ntpdate pool.ntp.org
# chkconfig ntpd on
# init 6

Step 2: Install FUSE-SSHFS :


For CentOS/RHEL users, Fuse SSHFS is available under epel repository, So make sure you have install epel repository in your system. Now execute following command to install it.

On CentOS/RHEL:

# yum -y install epel-release
# yum install -y fuse-sshfs

On Ubuntu & Dabian:

$ sudo apt-get update
$ sudo apt-get install sshfs

Step 3: Mount Remote Directory :


Lets mount remote server directory using sshfs, make sure remote system has running ssh server with proper ssh connectivity from your system.
First create a mount point:

# mkdir /mntssh

Lets mount the remote directory. For this example we are mounting /home/remoteuser directory from x.x.x.x (remote.example.com) system to our local system.

# sshfs remoteuser@remote.example.com:/home/remoteuser /mntssh

[Sample output]

The authenticity of host 'remote.example.com (x.x.x.x)' can't be established.
RSA key fingerprint is 77:85:9e:ff:de:2a:ef:49:68:09:9b:dc:f0:f3:09:07.
Are you sure you want to continue connecting (yes/no)? yes
remoteuser@remote.example.com's password: yes

Step 4: Verify Mount :


After mounting remote filesystem on local mount point, verify it by running mount command.

# mount

/dev/mapper/vg_svr1-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
remoteuser@remote.example.com:/home/remoteuser on /mntssh type fuse.sshfs (rw,nosuid,nodev)

Also naviate to your mount point, you will see files there from remote system

# cd /mntssh
# ls

Step 5: Mount Directory on System Boot :


If you want to mount remote filesystem automatically each time when your system reboots, Add following entry to /etc/fstab file. Make sure you have have key based ssh setup between remote and local system.

# vi /etc/fstab

remoteuser@remote.example.com:/home/remoteuser /mntssh fuse.sshfs defaults 0 0

--- save & quit (:wq) ---

Step 6: Unmount Directory :


If your work is over and you don’t need anymore the mounted directory, Simply unmount is using following command.

# umount /mntssh

Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog.

1 comments:

How To Install Sshfs On Centos/Rhel/Ubuntu - Sample Blog >>>>> Download Now

>>>>> Download Full

How To Install Sshfs On Centos/Rhel/Ubuntu - Sample Blog >>>>> Download LINK

>>>>> Download Now

How To Install Sshfs On Centos/Rhel/Ubuntu - Sample Blog >>>>> Download Full

>>>>> Download LINK