Mount remote filesystem using ssh and sshfs

This is short howto on how you can mount a remote filesystem through ssh and access in Debian it like any other local filesystem. This is a safer method to mount remote filesystems and a user can perform it without root privileges.

First you need to install sshfs

# aptitude install fuse-utils sshfs

Install the necessary kernel module

# modprobe fuse

If you haven’t installed the ssh server package already, now is the time

# aptitude install ssh

Mounting a remote filesystem is easy

sshfs username@hostname: mountpoint

Example

create the mount point

# mkdir /mnt/remotefilesystem
# chown [username]:[groupname] /mnt/remotefilesystem/

Add yourself to the newly created fuse group

adduser [your-user] fuse

switch to your user and mount the remote filesystem.

sshfs remote-user@remote.server:/remote/directory /mnt/remote/

You can specify any directory after the colon.

$ sshfs [user@]host:[dir] mountpoint [options]

If you want to unmount your directory use the following command

fusermount -u mountpoint