Operating System - HP-UX
1819778 Members
3192 Online
109607 Solutions
New Discussion юеВ

Re: umask set to 00 from... where?

 
SOLVED
Go to solution

umask set to 00 from... where?

Hi:

I have just installed HP-UX 11.11 in two boxes. In both of them /sbin/rc script sets umask to 022. No setup for umask is in /etc/profile. However, sessions are reporting umask as 00 (it is, 000). What other bott script could be changing umask after /sbin/rc does?

/etc/profile is not a godd choice to force umask as it is not read by at, batch and cron jobs. Thanks for your comments.
4 REPLIES 4
Jeff Schussele
Honored Contributor

Re: umask set to 00 from... where?

Hi Jose,

Well I believe that even IF the umask states 000 the OS will still *not* create files as such. UNIX imposes a minimum 022 mask which cannot be overriden. One has to manually chmod the file/dir after creation if you wish looser perms - although I never recommend it unless absolutely necessary & even then it's usually because things aren't architected properly.

My 2 cents,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: umask set to 00 from... where?

You can use /var/adm/cron/.proto to set the umask for cron and at jobs (man 4 proto for details); the remainder should be set in rc and /etc/profile. Note: Even doing this, umask is determined by the last ulimit whether in a shell script or executabl -- the last umask always wins.
If it ain't broke, I can fix that.
Jeff Schussele
Honored Contributor

Re: umask set to 00 from... where?

Correction....default umask is 111 for file creation & 000 for directory creation. My bad.
The umask of 022 is the most *common* user set mask.
If you cannot find any umask directives in .profile nor anything being called by it I would look at startup scripts for applications.
But one can also set umask with system calls & you wouldn't be able to see it unless you could see the source code.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Bill Hassell
Honored Contributor

Re: umask set to 00 from... where?

/sbin/rc has no effect on user logins. The rc steps refer only to startup scripts. Once the last script is complete, /sbin/rc is done and terminates. When a user signs on, the user's shell is started and the value of umask is set to the default 000 (see man umask).

Of course, this is flat out wrong from a sysadmin point of view because all files will be 666 permission and all directories 777, thus allowing anyone to trash anything that is ceated without subsequent tightening of the mode values. umask has remained unset in HP-UX for more than 20 years (as in many other Unix flavors) and every sysadmin must immediately set it in all the login profiles (/etc/profile, /etc/csh.login and others). Typically it should be set to 022 but I usually make root's mask 077, thus requiring root to make a conscious decision to open up the permissions on root-created files and directories.


Bill Hassell, sysadmin