I have two rasberrypi running debian wheezy and i would like to mount a folder from computer a on computer b.

What is the best (as in most efficient) way to do this?

I can do it via smb but for windows i think there has to be a better way to share across linux

Best Answer


SSHFS is wonderful. It can mount remote directories in a local directory with FUSE . The commands below use # to indicate that a command was executed as root , while $ indicates execution as a regular user. Because fuse software is required, first make sure that it is available and running.

One of the lsmod and grep commands, below, can reveal if the software is loaded and ready for use. A result from either command indicates that fuse is available.

# lsmod | grep fuse
$ grep -i fuse /lib/modules/$(uname -r)/modules.builtin

If there is no result from either command, try to load the kernel module without a reboot using modprobe and check again.

# modprobe fuse
# lsmod fuse

If loading the module fails, install the software with apt-get .

# apt-get install fuse

Check again after installation.

# modprobe fuse
# lsmod fuse

FUSE must be installed and running before continuing.


Check the permissions of /dev/fuse . The permissions should provide your regular user account with read and write access. Skip this part if you have determined that your regular user account already has read and write permission on /dev/fuse .

# ls -l /dev/fuse

The output might be something like the following

crw-rw-rw- 1 root root (all users can read/write)
crw------- 1 root fuse (only root can read/write)
crw-rw---- 1 root fuse (root and members of fuse group can read/write)

In 2013, my Debian created /dev/fuse with 0600 permissions, owner root , group owner fuse . I needed to let the fuse group use the device and to add my regular user account to the group, as shown below.

# usermod -aG fuse $your_regular_user_account
# chmod 0660 /dev/fuse

If the new group membership was required, log out and in again to become a member of the group.


Next, install ssh on both sides as follows.

# apt-get install ssh

This answer was written for Debian, but on Ubuntu 18.x at least, openssh-client , fuse , and a few other packages are a part of the Ubuntu sshfs package. The sshfs software is required on the client side, but it can be installed on both sides if desired. One of the package dependencies is fuse , but the installer skips over software that has already been installed.

# Ubuntu 18.x:
# apt-get install sshfs

With fuse and ssh available, and with permission to use the device, /dev/fuse , create a mount point for the remote file system; and, mount that remote filesystem locally as follows.

# mkdir /mnt/$directory_name
# chown $your_user:$group /mnt/$directory_name/
$ sshfs $remote_username@$remote_server_name: /mnt/$directory_name/

To mount a directory other than home, specify it after the colon.

$ sshfs $remote_username@$remote_server_name:/remote/directory /mnt/$directory_name

To unmount, use fusermount .

fusermount -u /mnt/$directory_name

If you have a Windows machine, it too can use SSHFS with win-sshfs . This software will "map a drive" with SSHFS, so that you can have a Windows drive letter that contains the remote directory.