LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices

Reply
 
Search this Thread
Old 09-16-2009, 08:06 PM   #1
luvlinux2009
LQ Newbie
 
Registered: Sep 2009
Posts: 12

Rep: Reputation: 0
set default umask to a directory or a group


Hi all,

Does anyone know how to set a default umask to a directory or to a group?
It seems you can only set the umask to a user.
I need to set the umask to a particular folder or group would work as well. The umask will be 002.
 
Old 09-16-2009, 08:41 PM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,246

Rep: Reputation: 2025Reputation: 2025Reputation: 2025Reputation: 2025Reputation: 2025Reputation: 2025Reputation: 2025Reputation: 2025Reputation: 2025Reputation: 2025Reputation: 2025
I don't think so...
What are you trying to achieve?
If you want a shared dir, use: chmod g+s dirname
http://ss64.com/bash/chmod.html
 
Old 09-17-2009, 12:52 PM   #3
luvlinux2009
LQ Newbie
 
Registered: Sep 2009
Posts: 12

Original Poster
Rep: Reputation: 0
I'm using g+s already. This sets the defined group ownership to any files/directories created under the parent directory where the g+s was set and works perfectly.

However as for the directory/file permissions, sub directores/files created under the parent do not get the same permissions as the root directory.
I need all the directories to be 775 and files 664 as I need all the members of this particular group to have full permissions to all the files/directories created (no matter who creates it as long as they're in the same group) under the parent directory.
If I could apply the umask of 002 to the group, this would work perfectly.

I guess I can create a cron job to run chmod -R g+w directoryname that will do this but I'd like for this to happen on the fly.
 
Old 09-17-2009, 01:29 PM   #4
grepmasterd
Member
 
Registered: Aug 2003
Location: Seattle
Distribution: ubuntu, lately
Posts: 182
Blog Entries: 1

Rep: Reputation: 35
I've seen this requested many times and I've never seen anyone post a solution. I believe it falls in the "can't be done" category. Under linux, users have full control over the files they own, not the filesystem. That's the model.

Whatever you implement will have to be an indirect modification, ie your cron job or some daemon running in the background. it can't be done inherently, afaik.
 
Old 09-17-2009, 08:54 PM   #5
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,246

Rep: Reputation: 2025Reputation: 2025Reputation: 2025Reputation: 2025Reputation: 2025Reputation: 2025Reputation: 2025Reputation: 2025Reputation: 2025Reputation: 2025Reputation: 2025
The soln (I think) in that case would be create a 'user' same name as the group and make the groupuser the owner of the dir. You can then apply the mask to user groupuser. Not sure if that'll work though. Let us know what happens.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Always set group write bit in given directory? jnojr Linux - Newbie 3 05-07-2009 07:29 PM
Set default umask for ssh as non-root WorkingClassHero Linux - Security 2 02-19-2008 10:09 AM
How to set the default group for a new user in SuSE. jschiwal Linux - Distributions 1 07-24-2004 11:25 PM
can you set a default umask for only certain directories? BrianK Linux - General 3 06-14-2004 09:02 PM
Where to set default file permissions (umask)? tredegar Linux - Newbie 14 01-27-2004 05:10 PM


All times are GMT -5. The time now is 12:47 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration