ixarissysadmin
asked on
Set default environment for root
I've set /etc/passwd so that /bin/bash is my shell for both the normal user as well as root. I've set up /etc/profile with a number of parameters i need (ex PATH, umask, PS1). When i log in with my user, i am assiging those settings. If i 'su -', i am also assigned those env settings.
However, if i just 'su' i lose them and get a default PATH of /usr/sbin:/usr/bin. interestingly, umask setting stays put.
Any ideas what's going on here?
However, if i just 'su' i lose them and get a default PATH of /usr/sbin:/usr/bin. interestingly, umask setting stays put.
Any ideas what's going on here?
ASKER
i did unhash SUPATH in that file and set it as i need, but nothing changed.
Do yo have .profile in roots home directory ( / ) ?
when you do su - then the system will simulate full root login and read /etc/profile , /.profile , etc. while su alone will just switch the userid to root with the same env.
the - in the su command is optional. If you want to have the environment of the user you are switching to you would use the su -.Just doing an su will only give you the privileges of the user without importing any environment variables.
Check for /.bash_profile
Check for /.bash_profile
ASKER
no i don't have a /.profile; nor a /.bash_profile
when i just 'su' my PATH changes to the default as stated above, whereas i want to change it.
when i just 'su' my PATH changes to the default as stated above, whereas i want to change it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If the first argument to su is a dash (-), the environment will be changed to what would be expected if the user actually logged in as the specified user. Otherwise, the environment is passed along, with the exception of $PATH, which is controlled by PATH and SUPATH in /etc/default/su.
http://docs.sun.com/app/docs/doc/816-5166/su-1m?a=view