> On 2021/10/05 01:42, Rex ford wrote:
> > Hello!
> > I may have found a bug, or an undocumented feature.
> > For context,
> > I am mounting a directory like this:
> > *sshfs rex@myserver:/mnt/my_mount /mnt/my_mount*
> > I understand that Theo disabled usermount because it's dangerous, but after
> > mounting a filesystem with sshfs and using root, the directory is ownership
> > shows root:wheel, and the mode is only letting root access anything.
> > 
> > If I try
> > *doas chown rex:rex /mnt/my_mount*
> > then
> > *ls -lah /mnt/my_mount*
> > I still see
> > *root:wheel as the user and group for that directory.*
> > 
> > Also, the* chmod* command is ignored on an sshfs mounted directory. Isn't
> > this a bug? Shouldn't I be able to mount the file system,* then* hand
> > privilege to another user afterward?
> > 
> > Generally, the goal is to access the data mounted by root with sshfs ...
> > but from a normal user.
> > 
> > Best regards,
> > Rex
> 
> I think this is expected. sshfs "idmap" options may help.

Or try -o allow_other,uid=1000,gid=1000,umask=007 to give user 1000 and group 
1000 full permissions,
but noone else.

Found in man 1 sshfs, section "fuse options"


Example:

bash-5.1$ ls -la
total 12
drwxr-xr-x   3 simon  simon  512 Oct 19 13:40 .
drwxr-xr-x  10 simon  simon  512 Oct 19 13:40 ..
drwxr-xr-x   2 simon  simon  512 Oct 19 13:40 admin02
bash-5.1$ doas sshfs simon@admin02:/home/simon admin02
bash-5.1$ ls -la
total 9
drwxr-xr-x   3 simon  simon  512 Oct 19 13:40 .
drwxr-xr-x  10 simon  simon  512 Oct 19 13:40 ..
drwx------   1 root   wheel  512 Oct 19 13:55 admin02
bash-5.1$ doas umount admin02
bash-5.1$ doas sshfs -o allow_other,uid=1000,gid=1000 simon@admin02:/home/simon 
admin02
bash-5.1$ ls -la
total 16
drwxr-xr-x   3 simon  simon   512 Oct 19 13:40 .
drwxr-xr-x  10 simon  simon   512 Oct 19 13:40 ..
drwxr-xr-x   1 simon  simon  4096 Oct 19 13:43 admin02
bash-5.1$ doas umount admin02
bash-5.1$ doas sshfs -o allow_other,uid=1000,gid=1000,umask=007 
simon@admin02:/home/simon admin02
bash-5.1$ ls -la
total 16
drwxr-xr-x   3 simon  simon   512 Oct 19 13:40 .
drwxr-xr-x  10 simon  simon   512 Oct 19 13:40 ..
drwxrwx---   1 simon  simon  4096 Oct 19 13:43 admin02
bash-5.1$ doas umount admin02
bash-5.1$ doas sshfs -o allow_other,uid=1000,gid=1000,umask=077 
simon@admin02:/home/simon admin02
bash-5.1$ ls -la
total 16
drwxr-xr-x   3 simon  simon   512 Oct 19 13:40 .
drwxr-xr-x  10 simon  simon   512 Oct 19 13:40 ..
drwx------   1 simon  simon  4096 Oct 19 13:43 admin02




Cheers, 

Simon

Attachment: signature.asc
Description: PGP signature

Reply via email to