Unable to stat SSHFS mount unless root

Posted on

Problem :

Does anyone understand why the nobody user is having trouble stat-ing the foo directory, when it definitely has execute permissions? It seems like there are some permissions I’m unaware of at this point. I’ve chmod 777’ed the folder at this point, but even then nobody cannot stat it.

Showing that foo is 777 and owned by nobody:

$ sudo ls -l                                                                                                                                                                                          [sudo] password for hamiltont:
total 12
drwxr-xr-x 2 nobody nogroup 4096 Feb 17 23:05 completed
drwxr-xr-x 3 nobody nogroup 4096 Feb 17 23:05 config
drwxrwxrwx 1 nobody nogroup 4096 Feb 17 19:55 foo

Showing that nobody cannot stat foo:

$ sudo su nobody                                                                                                                                                                                      nobody@ht-media:/lxc/sonarr$ ls -l
ls: cannot access foo: Permission denied
total 8
drwxr-xr-x 2 nobody nogroup 4096 Feb 17 23:05 completed
drwxr-xr-x 3 nobody nogroup 4096 Feb 17 23:05 config
d????????? ? ?      ?          ?            ? foo

The mount command is nothing special, just mount remote folder ~ from machine foo into /folder/foo as uid=nobody and gid=nogroup

sshfs -o uid=$(id -u nobody) -o gid=$(getent group nogroup | cut -d: -f3) foo:~ /folder/foo

Solution :

As per this answer on the Unix & Linux Stack Exchange site, it seems like you should use the allow_other option when initially mounting with SSHFS. So your command which looks like this now:

sshfs -o uid=$(id -u nobody) -o gid=$(getent group nogroup | cut -d: -f3) foo:~ /folder/foo

Should be changed to:

sshfs -o allow_other uid=$(id -u nobody) -o gid=$(getent group nogroup | cut -d: -f3) foo:~ /folder/foo

Leave a Reply

Your email address will not be published.