You are not logged in.

#1 2011-02-06 23:12:50

lio
Member
From: Montréal, Canada
Registered: 2009-09-13
Posts: 52

how to set "others" permission for new files created in folder ?

Hi all,

I have a setup where some users access via SFTP a folder in their home which is symlinked to "/srv/http/somefolder/" my apache public folder.

I would like it that every new file created on this folder default with permissions 775 so that they are immediately reachable from the web. Now they default with permission 600. I would like only this folder default permissions to be affected.

I have researched about this and found about the "sticky bits" but from what I understood it has to do with the default "group" permission. What I'm looking for is for the "others" part of the permission.

Can anyone who knows, point me in the good direction or to some information that I could research on.

Thanks,
lio

Offline

#2 2011-02-07 07:03:06

unilx
Member
From: Fredericton,Canada
Registered: 2009-10-01
Posts: 183

Re: how to set "others" permission for new files created in folder ?

Offline

#3 2011-02-08 00:01:29

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

Re: how to set "others" permission for new files created in folder ?

Google for "umask"

Offline

#4 2011-02-08 00:25:23

lio
Member
From: Montréal, Canada
Registered: 2009-09-13
Posts: 52

Re: how to set "others" permission for new files created in folder ?

Ok, thanks, I had ended on umask related explanations yesterday during my search. Now that I have the confirmation that this is how to achieve what I need, ill experiment with them.

Thank you again.

Offline

#5 2011-02-08 06:25:11

SeanM
Member
Registered: 2011-02-07
Posts: 25

Re: how to set "others" permission for new files created in folder ?

You can set the umask for the specified users, but I am not sure you can for specific directories using just the unix permissions. Two alternative options that should be considered:

ACL:
- Posix ACLs are supported by the Linux kernel, and I believe are installed by default in Arch (which actually surprised me a bit when I started using it...) The proposed standard was never actually ratified, but it is supported none the less. If you mount the filesystem that /srv/http/somefolder/ is on with the acl option (assuming that filesystem supports it, such as ext2/3/4 et al.) then you can set all files created to inherit permissions from a default ACL for the directory. Kind of a lot to learn about, but would certainly do what you want.

Scripts:
- It should be simple enough to create a script that will change all the permissions in a folder to have the permissions to desire... The trick is running it when needed. I believe there are programs that will hook into inotify and run whenever a filesystem event happens in a given directory, but I don't know off hand...

Offline

Board footer

Powered by FluxBB