Archive for the tag 'remote'

SSHfs: mounting remote filesystem over ssh?

What is sshfs ?

SSHFS is a filesystem client based on the SSH File Transfer Protocol. It uses the the Filesystem in userspace (FUSE) framework by Miklos Szeredi.

Advantages of SSHFS

While sshfs may not be as fast and featureful as other full-blown network filesystems such as NFS or Samba, it still has some great features:

1. Very easy to use, on the server side there’s nothing to do, on the client side mounting the filesystem is as easy as logging into the server with ssh

2. Provides secure (encrypted) access to remote files

3. Has decent performance (multithreaded, caching directory contents and allowing large reads)

4. Should work well even over slow and/or unstable links (think dialup), knows how to reconnect to the server when the connection is broken

Requirements

Fuse Kernel module must be installed and loaded before using sshfs.

Packages Required

1. Kernel Source ( for the current running kernel )

2. FUSE : http://jaist.dl.sourceforge.net/sourceforge/fuse/fuse-2.5.3.tar.gz

3. SSHFS-FUSE : http://jaist.dl.sourceforge.net/sourceforge/fuse/sshfs-fuse-1.6.tar.gz

4. OpenSSH client

Installing and configuring SSHFS

Installing FUSE

1. Download the FUSE kernel module source from http://jaist.dl.sourceforge.net/sourceforge/fuse/fuse-2.5.3.tar.gz
#wget http://jaist.dl.sourceforge.net/sourceforge/fuse/fuse-2.5.3.tar.gz

2. Go to your kernel source directory and prepare it if it is a fresh kernel source

#cd /usr/src/linux-2.6.9-5.EL
#make menuconfig

3. Untar the FUSE package and change directory to the source directory of FUSE

#tar xzf fuse-2.5.3.tar.gz
#cd fuse-2.5.3

4. Configure the Fuse source package .

#./configure –with-kernel=/usr/src/linux-2.6.9-5.EL

5. Build the fuse module and install it

#make
#make install

6. Load Fuse module into kernel

#modprobe fuse

Installing SSHFS

1. Download the sshfs-fuse package from http://jaist.dl.sourceforge.net/sourceforge/fuse/sshfs-fuse-1.6.tar.gz

#wget http://jaist.dl.sourceforge.net/sourceforge/fuse/sshfs-fuse-1.6.tar.gz

2. Untar the source package and change directory to sshfs-fuse source directory

#tar xzf sshfs-fuse-1.6.tar.gz
#cd sshfs-fuse-1.6

3. Build and install the sshfs

#./configure
#make
#make install

Using SSHFS

You can mount a remote directory using the command sshfs @host: eg:

#sshfs user1@192.168.1.215:/docs docs

If the sshd on remote server is listening on an alternateport, you can use -oport= eg: For sshd listening on 2222

#sshfs -oport=2222 user1@192.168.1.215:/docs docs

To unmount the filesystem, you can use fusermount -u eg:

#fusermount -u docs

« Prev