Is there a way to mount a Linux directory from a different PC to your local Linux PC? How?
5 Answers
sshfs is very nice, and easy to use
sshfs user@remotesystem:/remote/dir /some/local/dir

- 37,963
- 15
- 156
- 475

- 899
- 1
- 7
- 13
-
2Much simpler solution, especially for quick tasks. Something not clearly documented: -o ro will mount the file system readonly. – Artem Russakovskii Sep 07 '15 at 22:09
-
2Adding "-C" switch will enable compression and can greatly increase transfer speeds - in my case a 8 fold improvement. – Mtl Dev Dec 13 '16 at 15:53
-
If the SSH connection drops for any reason you may lose your data. Hence,you’d want to save your work regularly as you work on files within an SSHFS mount. – Hamedz Sep 27 '19 at 20:45
You need to be a bit more specific. You can use NFS.
Depending on what distro you're using, you simply edit the /etc/exports
file on the remote machine to export the directories you want, then start your NFS daemon.
Then on the local PC, you mount it using the following command:
mount -t nfs {remote_pc_address}:/remote/dir /some/local/dir
Use the man
utility for more information:
man exports (Examples of configuring directories for export are on the bottom of this manual page.)

- 37,963
- 15
- 156
- 475
-
1Why do I need to "export" the directory from the remote machine? Why isn't `mount -t nfs {remote_pc_address}:/remote/dir /some/local/dir` from the local machine enough? – a06e May 05 '15 at 12:32
NFS is handy since it's built-in and easy to configure, but the 2 common implementations (NFSv2 and NFSv3) don't translate usernames between the systems; user IDs are used instead. This requires you to use a central auth system such as LDAP so tha tcommon user IDs can be maintained.
sshfs requires you to connect as a single user and so accesses are always done (and consequently, can only be done) as that user.
cifs in a *nix-to-*nix connection (via Samba) both translates usernames and follows standard *nix permissions. As well, it is more flexible in that it allows you to perform ownership/permission transformation on creation of a new file or directory. It is, however, much more complex to configure.

- 37,963
- 15
- 156
- 475

- 776,304
- 153
- 1,341
- 1,358
-
1Is NFS still blocking you 100% if the remote computer is not available for whatever reason? – Alexis Wilke Mar 19 '15 at 00:27
sshfs works pretty well for me.
sudo sshfs -o allow_other root@1.2.3.4:/directory local_directory
remote machine ip : 1.2.3.4

- 37,963
- 15
- 156
- 475

- 77
- 1
- 3