LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 10-20-2003, 04:59 PM   #1
MartinMiller
LQ Newbie
 
Registered: Oct 2003
Posts: 8

Rep: Reputation: 0
default file rights with umask


Need the following rights when a user creates a file as the default.

rwxrw-r--

I think I need to change the umask. What file do I change and what umask do I need? bashrc is set umask 0000.

thx
 
Old 10-20-2003, 08:42 PM   #2
clacour
Member
 
Registered: Sep 2003
Location: Dallas, Tx, USA
Distribution: Red Hat, Gentoo, Libranet
Posts: 98

Rep: Reputation: 16
Quote:
Need the following rights when a user creates a file as the default.

rwxrw-r--

I think I need to change the umask. What file do I change and what umask do I need?
Umask isn't usually a file. It's a command you run, usually in one of the startup files (/etc/profile, the user's ~/.profile, ~/.bashrc or something like that.)

The umask you want is "013". The rule for a umask is to start off with full permissions (777). Then subtract the umask from that. In this case 777 - 013 = 764 (7 is rwx, 6 is rw-, and 4 is r--, which is what you want.)


Quote:
bashrc is set umask 0000.
If you mean there's a "umask 0000" in .bashrc, then change it there. If you don't mean that, I'm not sure what you mean, because a file can't be "set umask". (You might be getting that confused with setuid, which is a slightly different animal.)

Hope this helps,

CHL
 
Old 10-21-2003, 08:07 AM   #3
MartinMiller
LQ Newbie
 
Registered: Oct 2003
Posts: 8

Original Poster
Rep: Reputation: 0
Yes that fixed me up. I changed /etc/bashrc to umask 0013. That changes the default file rights for everyone to what I needed. Tanks a ton.
 
Old 10-21-2003, 02:08 PM   #4
MartinMiller
LQ Newbie
 
Registered: Oct 2003
Posts: 8

Original Poster
Rep: Reputation: 0
Wul crud. I have one user that still creates files as rwxr--r--. The user is running Word in windows and saving the file on the linux server. Anyone have any ideas. I changed umask in etc/profile to 0013. Also have changed the users .bashrc to 0013. I'ma STUCK.
 
Old 10-21-2003, 04:09 PM   #5
dorian33
Member
 
Registered: Jan 2003
Location: Poland, Warsaw
Distribution: LFS, Gentoo
Posts: 591

Rep: Reputation: 32
So you running samba. See man smb.conf. Look for 'create mode', 'force create mode', 'directory mode' and 'force directory mode'. Using these options you can do everything with permission rights.
 
Old 10-22-2003, 08:59 AM   #6
MartinMiller
LQ Newbie
 
Registered: Oct 2003
Posts: 8

Original Poster
Rep: Reputation: 0
Perfect. That was exactly what I needed to do. Thank you!
 
Old 10-22-2003, 10:04 AM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Please don't use a std 013 umask.

Need the following rights when a user creates a file as the default.
rwxrw-r--

* Files on a local Linux filesystem are NOT created with execute and "special" bits set. Since execute mode isn't set for files per default, 0013 means for file creation (write=4, read=2 and exec=1): limit "user" bits to 6, group limit 6, and world limit 2. The umask for these users should be "002".

* Setting 0013 as default umask is just plain wrong. Any user that sources /etc/bashrc, /etc/profile or wherever you set the umask will have their umask set to this value. If you need to centralize a non-std umask value for Sh and Bash users, and keeping in mind how interactive/non-interactive shells source their files, what you should do is set a sane default umask and do something like this (note a default box has all human UID's above 500):
umask 027; if [ "$(id -u)" -gt "500" ]; then umask 002; fi
Or, if you have just three UID's 501 561 and 990187 who need it set:
case "$(id -u)" in 501|561|990187) umask 002;; *) umask 027;; esac

* Keep in mind umask isn't a read-only variable, so any user is allowed to reset it's value.
 
  


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
Home Directory Default Rights Cottsay Linux - General 2 08-29-2005 01:44 PM
Umask and Linux Default Permissions Sandoomaphone Linux - Security 9 08-23-2004 04:48 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
umask and default file create permissions Rgamboa Linux - Newbie 5 05-20-2003 11:03 AM

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

All times are GMT -5. The time now is 01:41 PM.

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