LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 08-11-2007, 04:41 PM   #1
Cichlid
Member
 
Registered: Jan 2002
Location: Montreal
Distribution: Ubuntu 8.10
Posts: 178

Rep: Reputation: 30
group and file rw permissions


Hi All,

With the help of setfacl and chmod 2770 I have been able to accomplish half of my goal.

My goal: have twoo separate users write to a group specific directory where new files created by either user will be rw-rw----.

Currently, when either user creates a file is reads: rw-r--r--. Not what I want.

Any help would be greatly appreciated.
 
Old 08-11-2007, 06:44 PM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
You want to use the umask utility to set the default file creation permission. This is done when a user account logs in. The log in process involves automatically running some scripts that set up the user's environment. These files include but are not limited to /etc/bashrc and /etc/profile. Different distributions do this in different ways. My distribution has a directory /etc/profile.d with a bunch of scripts. Then the file /etc/profile runs all of the scripts in the /etc/profile.d directory. So I created a file called /etc/profile.d/z-myprofile.sh to set the umask and any other things that I want to do to a user's environment. This is the code to set the umask to what you want.
Code:
umask 027
 
Old 08-12-2007, 02:22 PM   #3
Cichlid
Member
 
Registered: Jan 2002
Location: Montreal
Distribution: Ubuntu 8.10
Posts: 178

Original Poster
Rep: Reputation: 30
Thanks a lot for your help.

I'm curious though, from what I understand, changing the umask in the etc/profile it will affect all users. Is this correct? Is there a way to use umask for certain users on a particular directory?
 
Old 08-12-2007, 07:54 PM   #4
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
Quote:
Originally Posted by Cichlid View Post
Thanks a lot for your help.

I'm curious though, from what I understand, changing the umask in the etc/profile it will affect all users. Is this correct? Is there a way to use umask for certain users on a particular directory?
You can specify which users have their umask reset by using bash logic. The umask cannot be controlled based on directory. This line will set the umask for user accounts that are in the mygroup user group.
Code:
test "`groups | grep mygroup`" && umask 027
The default setting of 022 is stupid. I always set the umask of user logins to 027 or 077. You should not want "others" to have any access to files that a normal user creates.

Last edited by stress_junkie; 08-12-2007 at 07:58 PM.
 
  


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
Help with group permissions? paddyjoy Linux - Newbie 5 11-13-2006 03:40 AM
www-data group not appearing in file permissions tab nick1 Ubuntu 1 05-01-2006 11:48 AM
Group File Permissions Devilin Linux - General 2 10-22-2005 07:06 PM
group permissions nanjil Suse/Novell 4 10-20-2005 01:51 PM
File/group permissions and sharing kscott121 Linux - Software 3 10-15-2005 10:39 AM


All times are GMT -5. The time now is 08:50 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