LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-18-2011, 09:46 AM   #1
Rike255
LQ Newbie
 
Registered: Apr 2011
Distribution: Red Hat
Posts: 17

Rep: Reputation: 0
umask questions


I have a user whose requirements are as follows:

Files created by the user are read/write by owner only
Directories created by the user are listable by owner and group

Basically I want to have group members able to list the users directories, but not read the files themselves.

Files: rw-------
Directories: rwxr-x--- ?(Don't know exactly what's required to allow for listing)

From what I can tell there is no way to set a users umask for specific file types. Does anyone know how I could accomplish this?

Thanks,
Ryan
 
Old 08-18-2011, 10:00 AM   #2
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
First, a terminology comment. This is not a umask question. Umask is a whole other utility entirely.

As for your question... you're right on target. Execute permissions on a directory is what's required to change to a directory and list its contents. So if we assume the same user:group owns the directory and all the files within it, and a user is not the owning user but is a member of the owning group, then yes, these permission settings will accomplish your goal.
 
Old 08-18-2011, 10:05 AM   #3
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
To clarify my previous post... the user requires execute permission to change to the directory, and read permission to perform an ls on it. Therefore, group permissions r-x on the directory are correct.
 
Old 08-18-2011, 10:32 AM   #4
Rike255
LQ Newbie
 
Registered: Apr 2011
Distribution: Red Hat
Posts: 17

Original Poster
Rep: Reputation: 0
Thanks for clarifying that part. The second piece of the puzzle is how I can set a users umask to provide different permissions for directories than for files. As you can see here my requirement is for files and directories to have different permissions for one user:

Files: rw-------
Directories: rwxr-x---

Basically, how would I go about setting a user so that any files or directories they create will have the permissions above? Like I said before I don't think there's a way to set separate umasks for different file types.

Thanks
 
Old 08-18-2011, 10:51 AM   #5
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
Oh, so the question is how do you make it so the permissions are correct when a user creates a new file... that is a umask question.

In this case, the umask value would be 0066. Files usually aren't created with the execute bit set, and this unsets r-w for group and public. You can test it yourself:

Code:
umask 0066
touch test.file
la test.file
You should see permissions rw------- for test.file.

Now, the question is whether this umask is appropriate for these users throughout the system, or if it's something they should only have within this specific directory. If the former, you can set the umask through their profiles, problem solved.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
umask and permissions: has umask 007 bad side effects? browny_amiga Linux - General 2 09-09-2011 08:01 AM
umask and /usr/bin/umask linux_user2011 Linux - Newbie 6 04-27-2011 02:05 AM
Permission and Umask questions Chaosbreaker Linux - Security 5 12-09-2010 04:13 AM
umask questions? scabrous1 Linux - Security 3 01-27-2006 02:21 PM
Umask metallica1973 Linux - Software 4 11-27-2005 01:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:41 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration