LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   Changing default umask (https://www.linuxquestions.org/questions/ubuntu-63/changing-default-umask-898640/)

lotsofquestions 08-21-2011 12:33 PM

Changing default umask
 
Hi I'm trying to set the default umask in several different ways on ubuntu 11.04

"There are no umask entries in /etc/init.d/rcS"

Can somebody please tell me what to put in /etc/init.d/rcS to set the umask to 077?


"There is no default umask settings for user login shells
in /etc/login.defs"

Can somebody please tell me what to put in /etc/login.defs to set the default umask to 077?


And can somebody please tell me how to set the default umask to 077 in
/etc/bashrc and /etc/profile

I want to set it in both to be safe, but I don't know what to put in the files to set the default to 077.

Any help with this would be appreciated!

tronayne 08-21-2011 01:14 PM

Do you have a file /etc/login.defs in Ubuntu? If so, you'll find it in there. It will (or should) look like
Code:

# Default initial "umask" value.
# UMASK is also used by useradd and newusers to set the mode of new home
# directories.
# 022 is the default value, but 027, or even 077, could be considered
# better for privacy. There is no One True Answer here: each sysadmin
# must make up her mind.
UMASK          022

If it's not there, try entering the above (and, of course, changing 022 to 077.

While I'm thinking about it, you could simply set it in /etc/profile with
Code:

export UMASK=077
Although that's a little overkill (you do it in /etc/profile to be sure you set the value in all shells -- bear in mind, however, that an individual user can override that setting in their own ~/.profile).

If that doesn't work, try (as root or sudo) to find the actual setting
Code:

cd /etc
find . -type f -print | grep -i umask

Hope this helps some.


All times are GMT -5. The time now is 10:26 PM.