How to: Mount Remote Directories using sshfs
So, we had this lab last week, doing some hands on work on Xen. While performing a task, one of the requirements was to make the directory structure look exactly the same as the one on the remote machine. One way, was to manually change the directory contents - filenames etc. and make it look similar to that on the remote system(pathetic way
), the other was to mount it remotely(better way). Thats when I came to know about this really quick and secure way of mounting remote locations using .
Well, the same could have been done using NFS but I found sshfs way faster than all of them(in terms of setup time, I work on LAN, everything seems same in terms of speed). Seriously people, its just like a regular ssh command, as simple as logging into a system, hardly takes a few seconds. I am pretty sure at the end of this post, you all will be turning towards it in time of need, ofcoure unless you know of a better method :P.
Its very easy to work with sshfs. Since, its supported by most of the ssh servers, all you have to do is install it on the client side and run a single && simple command. Lets first install it
Install sshfs on Linux
The package sshfs is available on almost all the distros. Run the concerned command on your system.
[shredder12]$ sudo aptitude install sshfs # for Debian/Ubuntu
[root]# yum install sshfs # for Redhat/Fedora/CentOS
Now, lets say there is some directory /mnt/dir/ on the remote system user@remote and we want to mount it on our /mnt directory. This is how we do it using sshfs.
[shredder12]$ sudo sshfs user@remote:/mnt/dir /mnt
Yep! Thats all Folks!
.
I used sudo because of permission issues. I hope now you all can see the power of sshfs.
2 Comments
Post new comment