Step1: Installing Package
On Ubuntu/Debain
Check if you are able to see data
#cd /mnt/ssh
#ls
Sample output
Sample output
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 12G 8.4G 2.5G 78% /
/dev/sda6 80G 43G 34G 56% /var
/dev/sda5 2.0G 41M 1.8G 3% /home
/dev/sda1 99M 12M 83M 12% /boot
tmpfs 506M 0 506M 0% /dev/shm
sshfs#root@10.233.10.212:/ 1000G 0 1000G 0% /mnt/ssh
Step4: So what about mounting it permanently?. We can do it by editing fstab file in /etc folder
#vi /etc/fstab
go to last line and type below line
sshfs#root@10.233.10.212:/ /mnt/ssh fuse defaults 0 0
Save the file and exit. Now run mount -a to update the fstab file state to kernel.
Note: Its not advisable to write passwords in human readable files like /etc/fstab.
#mount -a
Let me explain what entry in fstab indicates. We are mentioning mount user root data which is located on 10.233.10.212 server on to /mnt/ssh using fuse file system with default settings.
Step5: What about unmounting this drive?
apt-get install sshfsOn Redhat/CentOS/Fedora
rpm -ivh fuse-sshfs-1.8-1.el5.rf.i386.rpmStep2: Once the package is installed we have to create a mount point and mount our server data using sshfs command, for which we require username/password. Here are my details for this task.
My Username: root My password: redhat My Server: 10.233.10.212 My mount point: /mnt/sshNow create the mount point and mount SSH account data.
#mkdir /mnt/ssh #sshfs root@10.233.10.212:/ /mnt/ssh/
root@10.233.10.212's password:Step3: The above command will mount my root directory in 10.233.10.212 server. Testing our setup
Check if you are able to see data
#cd /mnt/ssh
#ls
Sample output
bin cdrom data etc initrd.img lib media opt root selinux sys tmp var vmlinuz.old boot cmdb-bkp dev home initrd.img.old lost+found mnt proc sbin srv test usr vmlinuzWhat about df -hs command output?
Sample output
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 12G 8.4G 2.5G 78% /
/dev/sda6 80G 43G 34G 56% /var
/dev/sda5 2.0G 41M 1.8G 3% /home
/dev/sda1 99M 12M 83M 12% /boot
tmpfs 506M 0 506M 0% /dev/shm
sshfs#root@10.233.10.212:/ 1000G 0 1000G 0% /mnt/ssh
Step4: So what about mounting it permanently?. We can do it by editing fstab file in /etc folder
#vi /etc/fstab
go to last line and type below line
sshfs#root@10.233.10.212:/ /mnt/ssh fuse defaults 0 0
Save the file and exit. Now run mount -a to update the fstab file state to kernel.
Note: Its not advisable to write passwords in human readable files like /etc/fstab.
#mount -a
Let me explain what entry in fstab indicates. We are mentioning mount user root data which is located on 10.233.10.212 server on to /mnt/ssh using fuse file system with default settings.
Step5: What about unmounting this drive?
#umount /mnt/sshEnjoy new learning of mounting a folder using SSH protocol.
No comments:
Post a Comment