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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
10-20-2003, 05:59 PM
|
#1
|
LQ Newbie
Registered: Oct 2003
Posts: 8
Rep:
|
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
|
|
|
10-20-2003, 09:42 PM
|
#2
|
Member
Registered: Sep 2003
Location: Dallas, Tx, USA
Distribution: Red Hat, Gentoo, Libranet
Posts: 98
Rep:
|
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
|
|
|
10-21-2003, 09:07 AM
|
#3
|
LQ Newbie
Registered: Oct 2003
Posts: 8
Original Poster
Rep:
|
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.
|
|
|
10-21-2003, 03:08 PM
|
#4
|
LQ Newbie
Registered: Oct 2003
Posts: 8
Original Poster
Rep:
|
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.
|
|
|
10-21-2003, 05:09 PM
|
#5
|
Member
Registered: Jan 2003
Location: Poland, Warsaw
Distribution: LFS, Gentoo
Posts: 591
Rep:
|
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.
|
|
|
10-22-2003, 09:59 AM
|
#6
|
LQ Newbie
Registered: Oct 2003
Posts: 8
Original Poster
Rep:
|
Perfect. That was exactly what I needed to do. Thank you!
|
|
|
10-22-2003, 11:04 AM
|
#7
|
Moderator
Registered: May 2001
Posts: 29,415
|
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.
|
|
|
All times are GMT -5. The time now is 06:20 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|