Operating System - HP-UX
1819931 Members
3129 Online
109607 Solutions
New Discussion юеВ

How to set root umask to 022

 
Roy Colica
Advisor

How to set root umask to 022

All,
I have a requirement to set root umask on a HP-UX system to 027. I can do it in .profile but all daemons already started will inherit the original umask (default is 0).
How do you think is possible to change from boot?
Thanks for your help.
Roy
7 REPLIES 7
Muthukumar_5
Honored Contributor

Re: How to set root umask to 022

Set that into /etc/profile file as,

if [[ ${LOGNAME} = "root" ]]
then
umask 022
fi

hth.
Easy to suggest when don't know about the problem!
Steven E. Protter
Exalted Contributor

Re: How to set root umask to 022

Shalom roy,

Root has an individual .profile

Its in root's home directory, which is usually / or /root/

Just add a umask 022 to .profile and you will be done.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Muthukumar_5
Honored Contributor

Re: How to set root umask to 022

umask setting will be set based on user accounts only. If you want to control to root users then put it in .profile of $HOME directory of root user or with /etc/profile as suggested in my previous reply.

If you want to control to all users then put it in /etc/profile with umask 022 content.

To change from boot then, put /usr/bin/umask 022 in /etc/rc.config file after for;do..done loop. (May work).

hth.


Easy to suggest when don't know about the problem!
Roy Colica
Advisor

Re: How to set root umask to 022

Updating both /.profile and /etc/rc.config file root daemons will write files with mask 0 or 027?
Roy
DCE
Honored Contributor

Re: How to set root umask to 022

I believe you can change the system umask in /sbin/rc.

A. Clay Stephenson
Acclaimed Contributor

Re: How to set root umask to 022

Bear in mind that you can set umask in /etc/profile, in root's .profile, and even in /sbin/rc for all the rc'ed scripts but that in no way guarantees that umask is then set for all processes --- even with a reboot. If a given executable makes a call to the umask() system call then the value of umask before that call makes no difference because the last umask setting for a given process wins. It will revert to the previous value when control returns to the parent process but if umask is called within a process there is no way to absolutely insure that umask is set to 027. This is actually a good thing because some utilities rely upon setting file modes to certain values regardless of umask.
If it ain't broke, I can fix that.
Roy Colica
Advisor

Re: How to set root umask to 022

Thanks.