SSHFS Remote File Access

Get There

Networking your machines to allow secure remote access of files is pretty easy with sshfs and fuse. The connection is encrypted so even wireless file transfer is secure.

You must have accounts on both machines. You must know the password for the target host you connect to. You may also need the host name and IP address listed in /etc/hosts file. This is particularly true if you run dhcp.

Ping the target host your connecting to find the IP address and make an entry in /etc/hosts.

First, download and install sshfs and fuse. We need both.

On Debian, do:

aptitude install sshfs fuse-utils

Check the fuse module is inserted into the kernel:

modprobe fuse

Next add yourself to fuse group:

adduser patrick fuse

In order to connect a file system from another machine, we need to create a mount point.

mkdir /mnt/remotefs

As its not in your home directory, change ownership and permissions.

chown patrick:patrick /mnt/remotefs

You can skip this step if the mount point is under your home directory.

Up to now we have run as user root. We can mount the remote file system as non-root user.

If you have used NFS in the past, the syntax is similar.

username @ remote-host : remote-directory local-mount-point

To connect to remote host named cobalt, I do:

patrick@cobalt:/home/patrick /mnt/remotefs

You will get a message from ssh quizzing on whether you trust host your connecting to and if you want to proceed. Type 'yes'.

You will be asked for the password on the remote machine. If you give the right password for the account. Your in.

Check the connection by cd'ing to /mnt/remotefs.

You should see your file.

To unmount sshfs, do:

fusermount -u /mount-point

For me it would be:

fusermount -u /mnt/remotefs

Done!