Question:How to edit root's profile

Hello everyone,

I am new to Solaris administration and I am trying to find a way to modify the profile of the superuser(root).

I wanted to set its ENVIRONMENT VARIABLES, and edit some things necessary.

I tried editing /etc/profile and exported some PATH, MANPATH but when I execute "su", it seems not to take effect.

I looked for the the .profile under root's home directory but I can't find it.

Also when I try to edit the root user's properties(this is through Solaris Management Console) and change its default shell from sh to BASH.. the SMC will output an error.

Any way to workaround this?

Thanks

[654 byte] By [mjamona] at [2007-11-27 4:02:52]
# 1

its a bad idea to change roots shell.

There are some other options.

Personally I have an normal account and use sudo to gain root priviledge.

Other options include creating an second "root2" account with a different shell.

And editing /etc/passwd to make its uid 0 as well.

But I'm not sure why stuff in /etc/profile isnt taking effect for an su shell.

Try putting it in the .profile in the home directory of either the unpriv account which you sido from or the root2 account

robert.cohena at 2007-7-12 9:07:37 > top of Java-index,Solaris Operating System,Solaris 10 Features...
# 2

Changing root's shell can be a source of serious problems. That is unless you replace it with another statically linked shell (like the default shell is).

One way around this is to exec bash from your /etc/profile or .profile. All the benefits of bash without the potential gotchas.

As for your profile problems. First of ~/.profile doesn't exist you can create it. That's probably the best place to put any customization to environmental variables you want to do that are specific to the root account.

As for the problem with environmental variables not being set, I've found that what seems to consistently work best for me is to set the variable then export it: e.g.

HOSTNAME=`/bin/hostname`

export HOSTNAME

I wouldn't follow the advice to set up a 2nd uid 0 user account. That only exposes you to security risks of having two superusers accounts as well as muddying up any audit/logging trails for actions taken. A much better (IMESHO) approach is to use RBAC or sudo to enable a normal user account access to the need root commands.

bosconeta at 2007-7-12 9:07:37 > top of Java-index,Solaris Operating System,Solaris 10 Features...
# 3
The profiles wont be run if you run 'su <user>', you have to run 'su - <user>' if you wish to source the users profiles.Even if .profile doesn't exists in roots home directory, you can create it. .7/M.
mAbrantea at 2007-7-12 9:07:37 > top of Java-index,Solaris Operating System,Solaris 10 Features...