So not everyone uses NFS. Actually most use sftp on linux since they can just use already existing open ssh ports to transfer data encrypted. The other problem is that many of us need to access smb/cifs shares on our linux boxes as well in an easy and simple fashion.

So here’s a little insight into how to do this.

I like to mount sftp shares to my home dir in linux.
We will install sshfs, then I will show you some different commands with it.

apt-get install sshfs sshfs remotesite:directoryonremotesite localdir options sshfs [email protected]:/home/user users.home -p 3445 -o allow_other

The above will mount the remote dir /home/user to the dir (in your current working dir) users.home on the local computer. The -p option specifies a port to use to connect if you are using a non-default port and the -o allow_other allows all users on the machine you have mounted on to read that directory.

How do you unmount?

fusermount -u users.home

Now onto mounting a smb/cifs share. We will actually use the mount command and its type option to do this:

apt-get install cifs-utils -y mount -w -t cifs //192.168.0.110/stor /mnt/lappy

This will mount (rw) the directory being shared on the remote host (stor) to the /mnt/lappy directory on the local host. Then just use the umount /mnt/lappy command to unmount it.

**Additionally, you can add “-o username=user” to the end of the mount command to define more arguments. Here’s another example:

mount -w -t cifs //192.168.0.110/stor /mnt/lappy -o username=user,password=weakpass,domain=SKOOL

Blog Logo

Mario Loria


Published

Image

./scriptthe.net

Because 127.0.0.1 gets old after a while.

Back to Overview