Friday, August 10, 2018

Re: sshfs permission problem

When you run anything that writes something, that something will have your umask. If you run something as root, set root's umask before running it, not afterwards. Write a script that sets the umask and runs sshfs, then run the script using doas.

On Fri, Aug 10, 2018 at 15:13, Hiltjo Posthuma <hiltjo@codemadness.org> wrote:

> On Fri, Aug 10, 2018 at 10:38:52AM +0200, Hiltjo Posthuma wrote:
>> On Fri, Aug 03, 2018 at 01:44:39PM +0200, Rudolf Sykora wrote:
>> > Hello!
>> >
>> > I run
>> >
>> > doas sshfs sykora@pc109.fzu.cz: /home/ruda/mnt/fzu -o uid=1000 -o gid=1000
>> >
>> > But then the mount point is owned (after the mounting) by root:
>> >
>> > drwx------ 1 root wheel 512 Aug 3 13:22 fzu
>> >
>> > Hence I cannot enter the directory as the usual (and wanted) user 'ruda'.
>> >
>> > 1) doas chmod 777 fzu does not help (does nothing)
>> > 2) doas chown ruda:ruda fzu gives permission denied
>> >
>> > What can I do?
>> >
>> > Thanks
>> > Ruda
>> >
>>
>> Hi,
>>
>> I have the same issue here.
>>
>> chmod 777 changes the permisions, but seems to reset them automatically after a
>> second or so.
>>
>> The umask 0000 suggestion doesn't work either unfortunately.
>>
>> On 6.3 this problem doesn't occur, but on -current it does. I'll try to bisect
>> it later.
>>
>> --
>> Kind regards,
>> Hiltjo
>>
>
> I figured it out and it doesn't seem like a bug, just a changed behaviour. The
> following commit changed it:
>
> CVS revision 1.47:
> http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libfuse/fuse.c?rev=1.47&content-type=text/x-cvsweb-markup
>
> or git commit:
>
> commit 0f4d2db5a50672bad418a08041219503c0deeced
> Author: helg <helg@openbsd.org>
> Date: Tue Jun 19 13:01:34 2018 +0000
>
> Changes the default mount behaviour so only the user that mounts the
> file system can access it unless the allow_other mount options is
> specified. The allow_other mount option makes the file system
> available to other users just like any other mounted file system.
>
> ok mpi@
>
> So the solution is to use the option: -o allow_other, for example:
> sshfs -o allow_other user@host:dir /mnt/mount
>
> I hope this helps someone.
>
> --
> Kind regards,
> Hiltjo

No comments:

Post a Comment