Archive

Posts Tagged ‘NFS’

Mounting NFS Resources

August 2, 2008 Leave a comment

Last week I published an article about mounting remote filesystems in Linux using the SSHFS method.

Today I’m covering another way of implementing a network filesystem; This method is the classic one and maybe one of the most used out there.

NFS stands for Network File System and the main difference between SSHFS is that NFS by himself is a network protocol, while SSHFS makes use of our favorite terminal access method: SSH.
NFS does NOT send the information through a secure tunnel, hence it is only recommended(and I really mean ONLY) on those situations where you trust your network traffic or have already implemented another way of authenticating the server.

The first step is to check whether or not our server has NFS daemon already installed; NFS is an extension of the mount command. By default, most Linux distributions already include the mount libraries.

# mount.nfs -V

Now, lets start the daemon.

$ /etc/init.d/nfs start

Lets suppose we want the folder /usr/man/ from computer HOST_ONE, to be mounted on /mnt/backup/ on computer HOST_TWO.

What we have to do is connect to HOST_ONE and tell the system which folders are authorized to be shared. This is defined in the exports file:

$ vi /etc/exports/

Probably the file would be empty, so lets start filling it. The asterisk tells the system to grant r,w,x privileges. :

/usr/man    *

Alternally you can add specific privileges enclosed by parentheses.

/usr/man    *(rw)

After saving the changes, restart the FNS daemon:

$ /etc/init.d/nfs start

This is everything we have to do on HOST_ONE. Nos its time to actually mount the filesystem on the remote computer.

$ mount -t nfs 192.168.10.20:/usr/man /mnt/backup

Alternately you can add the IP address of the machine to the /etc/hosts file and use the host name instead of the IP:

$ mount -t nfs HOST_ONE:/usr/man /mnt/backup

Advertisements
Categories: Filesystems Tags:

SSHFS – Mounting Network Filesystems in Linux

July 26, 2008 Leave a comment

Lets get a hold on the Secure Shell Filesystem Utilities (or just SSHFS to keep it more simple) using the awesome fuse libraries.

The things we need in order to use this method are the following:

  • sshfs
  • fuse-utils
  • fuse-source
  • kernel-headers
  • kernel-devel

For the lazy people, all the these packages are available through the yum repository in Fedora (and apt-get in Debian).

$ yum install fuse-utils
$ yum install fuse-source
$ yum install kernel-header
$ yum install kernel-devel

Since yum takes care of all the versions compatibility and dependencies you wont have to configure anything.

Of course you can do the manual way by downloading and installing the packages by hand. For the kernel-devel and kernel-header you have to chose the one that matches your specific kernel version. Keep in mind that in most cases the kernel-devel package already includes the headers for your linux distribution:

Download fuse here
And fuse-ssh here
And the kernel packages here

Now that you have the needed files let’s start installing the kernel-devel.

As root do the following:

$ rpm -Uvf kernel-devel.rpm

Then install the fuse utils:

$ tar -zxvf fuse-2.7.4.tar.gz
$ cd /fuse-2.7.4
$ ./configure --with-kernel=/usr/source/kernel/[YOUR KERNEL]
$ make
$ make install

Now lets install sshfs:

$ tar -zxvf sshfs-fuse-2.1.tar.gz
$ cd sshfs-fuse-2.1
$ ./configure
$ make
$ make install

That’s it! You can check it by typing sshfs --help on a terminal window.

Using sshfs is actually like using a standard ssh connection command.

For example, suppose you want to mount the directory /home/ which is located on the remote computer 192.168.10.20, on the local directory /mnt/backup/:

$ sshfs root@192.168.10.20:/home /mnt/backup

To unmount it just issue the following command:

$ fusermount -u /mnt/backup

Categories: Filesystems Tags: