FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 03-07-2012, 04:27 PM
Pierre Penninckx
 
Default sshfs and permissions

Hi all,

I'm using sshfs to access files on my server and it works great.
However I have a problem with permissions.

But first, my setup:
I have a server where I put all my
movies/musics/pictures/documents/backups of laptops/git projects.
It works with raid1 and lvm so it is quite secure and infinitely
scalable (well... I still need to buy hard drives).
This server will be accessible mostly by my family, some friends and
maybe some co-workers.
Every service one can access will be under /srv (/srv/movies,
/srv/pictures, etc.) or under /home/<username>.
Most of the computers are laptops. I have a Mac, my mom has a linux
OS, and my sister who lives in another house has a windows OS.

I'd like a quite basic permission system:
Family can do anything on the files but delete other's files;
Friends can only add or read;
And some friends will be able to write to git projects.
I don't explicitly need a chrooted environment.
I managed to do everything through ACLs apart making friends add
things and not delete other things:
in fact this would work if the sticky bit (chmod +t) could be
inherited when creating a new directory but it is not :/

So like I said I didn't manage to make permission 100% work through
sshfs, though it works on the server or through DokanFS.
The ACL on the /srv/movies folder is:
# file: movies
# owner: root
# group: videos
# flags: -s-
user::rwx
group::rwx
other::r-x
default:user::rwx
default:group::rwx
defaultther::r-x
(and the default user umask is 0022)

When creating a file in this directory while connect through the
server (or with DokanFS), the file has these permissions:
rw-rw-r-- fine.
But when creating it through sshfs it have:
rw-r--r-- bad.
And rwxr-xr-x for folders.

First, thanks for reading my long post.
Second, do you have any suggestions ?
I don't really know what to test.

Thanks,
Ibiz


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: CAMzgWy2yRoppDhW=ZjBZ29DZXO_-ZnTR9zR82J996+Ate9rZ0Q@mail.gmail.com">http://lists.debian.org/CAMzgWy2yRoppDhW=ZjBZ29DZXO_-ZnTR9zR82J996+Ate9rZ0Q@mail.gmail.com
 
Old 03-08-2012, 05:28 PM
Camaleón
 
Default sshfs and permissions

On Wed, 07 Mar 2012 18:27:29 +0100, Pierre Penninckx wrote:

(...)

> So like I said I didn't manage to make permission 100% work through
> sshfs, though it works on the server or through DokanFS. The ACL on the
> /srv/movies folder is: # file: movies
> # owner: root
> # group: videos
> # flags: -s-
> user::rwx
> group::rwx
> other::r-x
> default:user::rwx
> default:group::rwx
> defaultther::r-x
> (and the default user umask is 0022)
>
> When creating a file in this directory while connect through the server
> (or with DokanFS), the file has these permissions:
> rw-rw-r-- fine.
> But when creating it through sshfs it have:
> rw-r--r-- bad.
> And rwxr-xr-x for folders.
>
> First, thanks for reading my long post. Second, do you have any
> suggestions ? I don't really know what to test.

I Googled a bit and found some information about this problematic. For
instance, this blog article explains the issue quite well:

SSHFS: fix for wrong file permissions on server
http://andre.frimberger.de/index.php/linux/sshfs-fix-for-wrong-file-permissions-on-server/

I don't know if that matches for your current situation nor if it helps
you in any way but maybe can trigger a light in your head :-)

Greetings,

--
Camaleón


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: jjato9$ek5$14@dough.gmane.org">http://lists.debian.org/jjato9$ek5$14@dough.gmane.org
 
Old 03-08-2012, 10:30 PM
Rob Owens
 
Default sshfs and permissions

On Wed, Mar 07, 2012 at 06:27:29PM +0100, Pierre Penninckx wrote:
> Hi all,
>
> I'm using sshfs to access files on my server and it works great.
> However I have a problem with permissions.
>
I recall having similar issues several years ago. I don't remember
exactly how I fixed it, but possibly with '-o allow_other' on the sshfs
command. Looks like you can also do '-o umask=755' and '-o
gid=something' if you need to.

-Rob


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20120308233011.GA27198@aurora.owens.net">http://lists.debian.org/20120308233011.GA27198@aurora.owens.net
 
Old 03-09-2012, 03:00 AM
Tom H
 
Default sshfs and permissions

On Thu, Mar 8, 2012 at 1:28 PM, Camaleón <noelamac@gmail.com> wrote:
> On Wed, 07 Mar 2012 18:27:29 +0100, Pierre Penninckx wrote:
>
> (...)
>
>> So like I said I didn't manage to make permission 100% work through
>> sshfs, though it works on the server or through DokanFS. The ACL on the
>> /srv/movies folder is: # file: movies
>> # owner: root
>> # group: videos
>> # flags: -s-
>> user::rwx
>> group::rwx
>> other::r-x
>> default:user::rwx
>> default:group::rwx
>> defaultther::r-x
>> (and the default user umask is 0022)
>>
>> When creating a file in this directory while connect through the server
>> (or with DokanFS), the file has these permissions:
>> rw-rw-r-- fine.
>> But when creating it through sshfs it have:
>> rw-r--r-- bad.
>> And rwxr-xr-x for folders.
>>
>> First, thanks for reading my long post. Second, do you have any
>> suggestions ? I don't really know what to test.
>
> I Googled a bit and found some information about this problematic. For
> instance, this blog article explains the issue quite well:
>
> SSHFS: fix for wrong file permissions on server
> http://andre.frimberger.de/index.php/linux/sshfs-fix-for-wrong-file-permissions-on-server/
>
> I don't know if that matches for your current situation nor if it helps
> you in any way but maybe can trigger a light in your head :-)

The first paragraph of that URL mentions sftp, "SSHFS normally
propagates the umask of the client to the server. This works great
when the sftp server doesn’t care about the umask while creating files
or directories. But the problem is, that the openssh sftp server
indeed cares about the server side umask", so I checked the sshfs man
page and it says "On the remote computer the SFTP subsystem of SSH is
used". You should therefore be able to set the umask for sftp via the
usual wrapper script and get the umask that you want.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: CAOdo=SziNA6w+ru6jtgmDbu9Y03mVTPqqEj+-xDbUtcedh+R0g@mail.gmail.com">http://lists.debian.org/CAOdo=SziNA6w+ru6jtgmDbu9Y03mVTPqqEj+-xDbUtcedh+R0g@mail.gmail.com
 
Old 03-14-2012, 10:21 PM
Pierre Penninckx
 
Default sshfs and permissions

2012/3/9 Tom H <tomh0665@gmail.com>:
> On Thu, Mar 8, 2012 at 1:28 PM, Camaleón <noelamac@gmail.com> wrote:
>> On Wed, 07 Mar 2012 18:27:29 +0100, Pierre Penninckx wrote:
>>
>> (...)
>>
>>> So like I said I didn't manage to make permission 100% work through
>>> sshfs, though it works on the server or through DokanFS. The ACL on the
>>> /srv/movies folder is: # file: movies
>>> # owner: root
>>> # group: videos
>>> # flags: -s-
>>> user::rwx
>>> group::rwx
>>> other::r-x
>>> default:user::rwx
>>> default:group::rwx
>>> defaultther::r-x
>>> (and the default user umask is 0022)
>>>
>>> When creating a file in this directory while connect through the server
>>> (or with DokanFS), the file has these permissions:
>>> rw-rw-r-- fine.
>>> But when creating it through sshfs it have:
>>> rw-r--r-- bad.
>>> And rwxr-xr-x for folders.
>>>
>>> First, thanks for reading my long post. Second, do you have any
>>> suggestions ? I don't really know what to test.
>>
>> I Googled a bit and found some information about this problematic. For
>> instance, this blog article explains the issue quite well:
>>
>> SSHFS: fix for wrong file permissions on server
>> http://andre.frimberger.de/index.php/linux/sshfs-fix-for-wrong-file-permissions-on-server/
>>
>> I don't know if that matches for your current situation nor if it helps
>> you in any way but maybe can trigger a light in your head :-)
>
> The first paragraph of that URL mentions sftp, "SSHFS normally
> propagates the umask of the client to the server. This works great
> when the sftp server doesn’t care about the umask while creating files
> or directories. But the problem is, that the openssh sftp server
> indeed cares about the server side umask", so I checked the sshfs man
> page and it says "On the remote computer the SFTP subsystem of SSH is
> used". You should therefore be able to set the umask for sftp via the
> usual wrapper script and get the umask that you want.
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> Archive: http://lists.debian.org/CAOdoSziNA6w+ru6jtgmDbu9Y03mVTPqqEj+-xDbUtcedh+R0g@mail.gmail.com
>

First, thank you for your help and sorry for the response delay.

Here are the options I used:
`-o uid=501 -o gid=20 -o umask=002`

For what I understand, the main purpose of these options are to fool
the client permissions.
In fact, it seems there's no relation between the permissions on the
server and the permissions seen from the client.
>From the client, all the folders and files are owned by 501/20
(user/group) and have a 775 permission (files also have 775 and not
664).
But the permissions are still working: the server does not allow me to
do actions I don't have permission to do.

For example, if on the server I create a file with
touch a && chmod 000 a
on the server if I `ls -l` it gives me:
---------- a
but on the client
-rwxrwxr-x a

@Camaleón:
I will make remarks on the link you provided me.
Approach 1: This doesn't work, for the reasons I said above.
Approach 2 & 3: These approaches are technically the same: fixing
the problem afterwards. This works great but I don't find it very neat
so I will use it if really necessary. Also, `inotifywatch` should do
the trick.

@Rob Owens:
I tried the `-o allow_other` but this only let me access the mounted
directory with another user on the client side. This doesn't fix the
problem.

@ Tom H:
This seems to be the problem but I must say that I don't really
understand what this paragraph means, especially this:
"But the problem is, that the openssh sftp server indeed cares about
the server side umask [...] On the remote computer the SFTP subsystem
of SSH is used. You should therefore be able to set the umask for sftp
via the usual wrapper script and get the umask that you want."
What wrapper script ?

I must apologize if I didn't make it clear before, but the problem is
not only a umask problem, it's also an ACL problem (I think).
In fact, the umask of the user on the server is 002 and when I create
a file through sshfs, the permissions are correct (755 or 644).
The thing is I added default ACLs like the `default:group` option and
it doesn't seem to be applied, though if I `getfacl` on the files
created on the client side it seems the permissions are correct.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: CAMzgWy0Tva-ukfqYgkR+MnAJFFA3rzUY-RaUMTA8hiTtnX3-7g@mail.gmail.com">http://lists.debian.org/CAMzgWy0Tva-ukfqYgkR+MnAJFFA3rzUY-RaUMTA8hiTtnX3-7g@mail.gmail.com
 
Old 03-15-2012, 11:03 AM
Tom H
 
Default sshfs and permissions

On Wed, Mar 14, 2012 at 7:21 PM, Pierre Penninckx
<Pierre.Penninckx@gmail.com> wrote:
>
> @ Tom H:
> This seems to be the problem but I must say that I don't really
> understand what this paragraph means, especially this:
> *"But the problem is, that the openssh sftp server indeed cares about
> the server side umask [...] On the remote computer the SFTP subsystem
> of SSH is used. You should therefore be able to set the umask for sftp
> via the usual wrapper script and get the umask that you want."
> What wrapper script ?

The wrapper script is to change the "Subsystem sftp ..." lin in
"/etc/ssh/sshd_config" to "Subsystem sftp
/usr/local/bin/sftp-server.sh" and override the default "0022" umask
by creating "/usr/local/bin/sftp-server.sh" as:
#!/bin/sh
umask 0002
/usr/lib/openssh/sftp-server

I've never seen any acl-related configuration possibilities in
sshd_config (which doesn't mean that they don't exist!). Maybe you can
set up "AllowGroups ..." and/or "Match Group ..." stanzas that'll make
ssh/sftp behave the way that you'd like them to.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: CAOdo=Sye4XdfO1dBUwrRa4M7K4Zy9_Byqp7cvwnp3Sj+HvLaW w@mail.gmail.com">http://lists.debian.org/CAOdo=Sye4XdfO1dBUwrRa4M7K4Zy9_Byqp7cvwnp3Sj+HvLaW w@mail.gmail.com
 

Thread Tools




All times are GMT. The time now is 05:05 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org