Linux - GeneralThis 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.
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.
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.)
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.