Operating System - HP-UX
1834809 Members
2341 Online
110070 Solutions
New Discussion

Re: umask difference between login and su -

 
Mike Kuhar
Advisor

umask difference between login and su -

When a user logs in as oracle, the umask setting is 7077. If the user is logged in as himself and su - oracle, the umask is 022. Any have any idea why?
14 REPLIES 14
Steven E. Protter
Exalted Contributor

Re: umask difference between login and su -

Yes.

It is being set by the .profile file for user oracle, or in one of the configuration files that .profile reads.

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
Jorge Fabregas
Regular Advisor

Re: umask difference between login and su -

Hello Mike,

I don't understand completely what you're trying to say. Is it: If you're , for example, logged in as root and then do a "su - oracle" the umask is going to be different than when you log in as oracle? It should be the same.

Check the user .profile. Maybe there's a line in there specifying the umask.

Jorge
Steven E. Protter
Exalted Contributor

Re: umask difference between login and su -

Apologies for my earlier response:

find /home -exec grep -li 'umask' {} \;

umask is getting set somewhere, you need to trace in and figure out where its being set. Also check /etc/profile

I bet there is a conflict between .profile or something in the chain and /etc/profile

su - is supposed to load the SAME environment as a straight login.

su without the dash does not load the environment or umask settings.

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
Mike Kuhar
Advisor

Re: umask difference between login and su -

I was under the impression that .profile was read when you 'su -' into that user. According to the man page, "If the - option is specified, the new shell starts up as if the user had initiated a new login session." What am I missing?
Mike Kuhar
Advisor

Re: umask difference between login and su -

I tried the command you supplied Steven, and it didn't bring to light anything that I didn't already know. This is a trusted system. Would a umask be set somewhere else other than the standard places?
T G Manikandan
Honored Contributor

Re: umask difference between login and su -

If you are using bourne /ksh check

/etc/profile --system wide file
.profile-placed in users home dir

Also check any script placed inside these files.

Dietmar Konermann
Honored Contributor

Re: umask difference between login and su -

If we are talking about 11.00 then you should install Patch PHKL_23226 (replaced by PHKL_29434).

PHKL_23226:
( SR: 8606175710 CR: JAGad44950 )
umask(1) may incorrectly set file permission bits.

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Mark Grant
Honored Contributor

Re: umask difference between login and su -

Another question. Do your users happen to log in using "X" i.e. do they get a graphical login but then run an *term in order to "su -". If this is the case, then none of the normal shell initialization files get run by default and you are would need to start looking at X configuration files instead. One more thing, if you set a umask and "su -" to an account that doesn't have one set, you keep your umask.
Never preceed any demonstration with anything more predictive than "watch this"
Dietmar Konermann
Honored Contributor

Re: umask difference between login and su -

BTW, why I believe this to be not a scripting but a kernel problem...

# umask 7077
sh: umask: The specified number is not valid for this command.

7077 is an illegal umask. You cannot set that from user land. :-)

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Mike Kuhar
Advisor

Re: umask difference between login and su -

Thanks Dietmar. I'm sure that's the problem. I couldn't find, anywhere, where this umask was being set. As temporary fix, can I just set umask to 022 in Oracle's .profile?
Dietmar Konermann
Honored Contributor

Re: umask difference between login and su -

Of course you can. But take care to install that patch to get the root cause fixed.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Mike Kuhar
Advisor

Re: umask difference between login and su -

Thanks Dietmar. Will do. This is just a temp fix until I get a window to do some major patching of the system. Thanks again.
Bruno Ganino
Honored Contributor

Re: umask difference between login and su -

This error could be verified when there is installed suidperl. Confused with umask 077.
Torino (Turin) +2H
Sanjay_6
Honored Contributor

Re: umask difference between login and su -

Hi Mike,

Check and see if the umash is being set using .profile or some other script. If it is being set using .profile then it should be set to the required umash setting when you do a su - user.

Hope this helps.

Regds