1825795 Members
2264 Online
109687 Solutions
New Discussion

Regarding shell for root

 
SOLVED
Go to solution
SYS ADMIN_7
Advisor

Regarding shell for root

Hi

I need a simple sollution from GURUs.
I all of you know the shell for root should be from /sbin only not from /usr/bin.
This is needed as system may give problem is you are booting in single user mode as /usr is by default is mounted.Please correct if wrong. Now my question is

1) Which are file systems by defalut mounted in case of single user mode.. I can not test on my prduction server.. I heard some times the root is mounted as /dev/root instead on\f /dev/vg00/lvol1 in case of single user mode. if yes why ..Please help
2)If I want the shell of root to be from /usr/bin when the system is booting other than single user mode, what change i have to make in the /etc/profile or .profile or in case of Cshell also.

Hope there is no confusion and I will get the answer.


Thanks
Suraj
8 REPLIES 8
Robert-Jan Goossens_1
Honored Contributor

Re: Regarding shell for root

Hi Suraj,

If you are booting in single user mode /usr is not mounted, the only filesytem mounted is / therefore you need the root shell to be /sbin/sh.

If you need to boot in lvm maintenance mode / is mounted as /dev/root. To avoid problems you need to shutdown from maintenance mode with shutdown -r instead of going to multi user mode directly.

Best regards,
Robert-Jan
T G Manikandan
Honored Contributor

Re: Regarding shell for root

When the system was previously booted into lvm maintenance mode the / file system gets mounted as /dev/root.

To resolve this you can do a
#mv /etc/mnttab /etc/mnttab.org
#mount -a

Regarding the shell for root user,the root users shell should be /sbin/sh.do not change that.

Incase you want the root user to use a different shell during login add

/usr/bin/ksh to the last line of the $HOME/.profile file of the root user.
Slawomir Gora
Honored Contributor

Re: Regarding shell for root

Hi,

in single user mode (hpux -is) you have mounted:
/ on /dev/vg00/lvol3
/stand on /dev/vg00/lvol1
Sridhar Bhaskarla
Honored Contributor

Re: Regarding shell for root

Hi Suraj,

1. If there are no issues (like fsck successful etc.,) with the filesystems, then / and /stand will be mounted in singleuser mode. If there is a problem where / is not mountable, then it's pseudo device /dev/root is mounted as a precautionary measure.

2. Use .profile rather than /etc/profile as it affects all the users that are using ksh. .cshrc for C-shell doesn't play a role here as root's shell will be /sbin/sh by default.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
SYS ADMIN_7
Advisor

Re: Regarding shell for root

Hi All

Thanks a lot

TGM Thanks for the nice trick..
However, if i want to to repat the previous commands using Esc K combination its not happening.

Can u please tell why.. Give some briefs if possible

Rgds
Suraj
Victor BERRIDGE
Honored Contributor
Solution

Re: Regarding shell for root

Hi,
the main difference is /usr/bin/ksh is dynamicaly linked...
I have seen other sysadmins struggle with they system when had to do some easy maintenace task because they put in /etc/passwd /usr/bin/ksh...
An example? Without Online-JFS having to extend /var...

So for beeing on the safe side, typing after you log on the shell you want to use isnt that bad....

All the best
Victor
Victor BERRIDGE
Honored Contributor

Re: Regarding shell for root

To use Esc-K means you are using ksh, if it knows of you HISTORY file (in .profile) then if you are not using a .kshrc (Because you did what I said previously) then just type set -o vi


All the best
Victor
SYS ADMIN_7
Advisor

Re: Regarding shell for root

Hi Victor

Thanks

I am closing this thread..
Once again thnaks all who helped me..

Thanks
Suraj