Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 that is for windows, I think there must be a better way to share across linux.

share|improve this question
Possible copy of Download copy of file which updates on change – dchirikov Jan 26 '13 at 20:58
up vote 15 down vote accepted

You can use plenty of things, among which, popular options are:

  • NFS
  • Samba / CIFS

By ease-of-setup I think they would have to be put in this order (top: easiest)


Through FUSE, you can mount remote filesystems via ssh. I won't cover how, as Cristopher has already very well explained that. Just note that, in order to mount the file automatically it will need a bit more of work.


It will allow you to use Windows and Unix machines to access the remote folder. If it's not a big deal for you, then you won't probably benefit from it. However, it's easy to automount it on init (just input the apropriate values at /etc/fstab, including username=<your-samba-username>,password=<your-samba-password> in the options column.


It will let you authenticate just via IP (no usernames thing = faster, only of use inside your non-hostile LAN) or via Kerberos Tickets (too painful for just two Raspberries; but useful in corporate environments).

As it has kernel mode support, it will run faster than sshfs. Besides, as there's no encryption performed it will have a better throughput, and in the case of the tiny Raspberry ARM, it may make a difference.

Besides, it's not so painful to setup simply you trust your network. You have automount support in /etc/fstab too, and you don't have to put sensitive data (such as usernames or passwords), and if you have your usernames syncrhronized (same /etc/passwd and /etc/group files) you can use the usual POSIX permissions toolset (chown, chgrp and chmod).

share|improve this answer
I use my Pi as an NFS server with a disks with mostly my movies and other media (ie not system-critical stuff, not '/home/' or anything similar). NFS allows me to watch a movie without first having to copy it to the local drive, but when writing files to the NFS disk I prefer to use rsync. I've therefore mounted my NFS disks readonly, and write stuff over SSH (with rsync). This also stops me from accidentally rsyncing to an NFS mounted disk (which is very inefficient). – zrajm Feb 2 '14 at 23:05
@zrajm how to you mount your disks on the pi? – FutuToad Mar 7 '14 at 16:30
arisu:/mnt/ytra /mnt/ytra nfs soft,ro,intr 0 2 – zrajm Mar 11 '14 at 22:11
Samba may confuse some unix applications, notably around permissions or what stat() returns, e.g. things that rely on the nlink count which CIFS has no notion of. SSHFS I've been not much impressed with, as it ran context switches on the fileserver up mighty high, and did not support the necessary locking required by in-house programs. So, NFS... – thrig Nov 5 '15 at 21:25

SSHFS is wonderful; it can mount remote directories in a local directory.

You could install ssh on both sides:

# apt-get install ssh

On the client side, or both sides if desired, install sshfs and fuse utilities:

# apt-get install fuse-utils sshfs

Without reboot, load the kernel module:

# modprobe fuse

Create a mount point for the remote file system:

# mkdir /mnt/directory-name
# chown your-user:group /mnt/directory-name/

Add your username to the fuse group:

# usermod -a -G fuse [your-user]

My Debian creates /dev/fuse with 0600 permissions, so let the fuse group use the device:

# chmod 0660 /dev/fuse

Your user account may need to log out and in again to become a member of the fuse group. Then as the regular user...

$ 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


fusermount -u /mnt/directory-name

The commands above use # to indicate that it was done as the root user, and the $ indicates that it was done as a regular user.

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.

share|improve this answer

In linux, you would choose for NFS (also check out the article on archwiki about it which may have applicable information for your distribution aswell). It has more advanced features then samba. If you need to lock (i.e. concurrent acces) files you should look into lockd aswell because nfs is stateless. However it is harder to configure than smb. I would suggest trying both samba and nfs to see which one suits your needs.

share|improve this answer

I have used both SFTP net drive and ExpanDrive in the past and I can tell you sshfs outperforms both without a question.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.