I changed computers, and now I have trouble getting sshfs to work again.
Using the command sshfs user@server:/home/user/ /mnt/server
fails with an:
fusermount3: mount failed: Operation not permitted.
When I run the command with a preceeding sudo
, it works - but that's somewhat beside the point. This used to work without using sudo.
This used to work on my older machine, which was also running Ubuntu 22.04. However, it's been a while since I set the old machine up, so I guess I may have forgotten something.
The mount-directory /mnt/server belongs to my current user, both as owner and with the group.
Simply logging in using ssh works, i.e., using ssh user@server
. So, what is the operation that is not permitted?
The mount-point looks as follows:
user@host:~$ ls -ld /mnt/server
drwxr-xr-x 2 user user 4096 Jän 16 17:30 /mnt/server
user@host:~$
Further info:
user@host:~$ type -a fusermount3
fusermount3 ist /usr/bin/fusermount3
fusermount3 ist /bin/fusermount3
user@host:~$ ls -l /usr/bin/fusermount3
-rwxr-xr-x 1 root root 35200 Mär 23 2022 /usr/bin/fusermount3
I tried it on a different computer, also running Ubuntu-22.04, and I noticed some differences in the groups, that the local user is a member of:
user@host:~$ id
uid=1003(user) gid=1003(user) Gruppen=1003(user),27(sudo),46(plugdev)
user@otherHost:~$ id
uid=1000(user) gid=1000(user) Gruppen=1000(user),4(adm),27(sudo),30(dip),46(plugdev),122(lpadmin),134(lxd),135(sambashare)
With host
being the computer, where it's not working; and otherHost
being the other computer where it works.
Your:
... is missing the set-user-ID bit while it should be there by default for non-admin users to be able to use that command for mounting a filesystem ... That bit when set will run the command as the owner user i.e.
root
regardless of the invoking user/process or else the command will run as the invoking user instead and you will need to either beroot
or usesudo
as you have experienced.Run:
... to set that bit so it will look like this:
... and then try your command again and it should work.