Posted: . At: 10:59 AM. This was 2 years ago. Post ID: 16452
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


How to mount a remote folder on a server over SSH with SSHFS properly.


Mounting a folder over SSH can be problematic, the restrictions imposed by the FUSE filesystem layer mean you can not access the folder once mounted as root using sudo.

Use this parameter to SSHFS.

-o allow_other

Without this option, only the user who ran sshfs can access the mount. This is a fuse restriction. More info is available by typing man fuse.

You should also note that (on Ubuntu at least) you need to be a member of the ‘fuse’ group, otherwise the command above will complain about not being able to access /etc/fuse.conf when ran without ‘sudo’.

┌──(john㉿DESKTOP-PF01IEE)-[/mnt]
└─$ sudo sshfs -o allow_other jason@192.168.1.2:/home/jason/Documents /mnt/external
jason@192.168.1.2's password:

Once the folder is mounted successfully, it will look like this.

jason@192.168.1.2:/home/jason/Documents on /mnt/external type fuse.sshfs (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)

And you may then access the files therein.

┌──(john㉿DESKTOP-PF01IEE)-[/mnt]
└─$ ls -hula /mnt/external/
total 4.2M
drwxr-xr-x  1 john john 4.0K Jul 12 10:29 .
drwxr-xr-x 13 root root 4.0K Jul 12 10:41 ..
-rw-rw-r--  1 john john 2.4M Oct 29  2020 ballgirl.webm
-rw-rw-r--  1 john john 1.5M Feb 16 10:24 ballreaction.webm
-rw-------  1 john john 236K Apr 30  2021 message.txt
-rw-rw-r--  1 john john    9 Feb 18 09:05 nc
-rw-rw-r--  1 john john  101 Feb 18 09:05 nc.nasm
-rw-------  1 john john    0 Jun 19 12:52 nohup.out
drwxrwxr-x  1 john john 4.0K Jul 12 10:29 systemd
-rw-rw-r--  1 john john  275 Feb 16 10:22 testing.c
drwxrwxr-x  1 john john 4.0K Jul 12 10:29 this_is_a_dir_

The directory will be writable for your current user when mounted over SSH, this is a great way to copy and move files to a remote machine. A very useful networking tip on a Linux LAN.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.