- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- why root's shell is /sbin/sh?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 06:20 AM
08-15-2006 06:20 AM
why root's shell is /sbin/sh?
The login shell for the root user (uid 0) must be /sbin/sh. Other shells such as sh, ksh, and csh are all located under the /usr directory which may not be mounted during earlier stages of the bootup
process. Changing the login shell of the root user to a value other than /sbin/sh may result in a non-functional system.
why? Changing the login shell of the root user to a value other than /sbin/sh may result in a non-functional system. ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 06:23 AM
08-15-2006 06:23 AM
Re: why root's shell is /sbin/sh?
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 06:27 AM
08-15-2006 06:27 AM
Re: why root's shell is /sbin/sh?
whe the system boots, root is the owner of vital processes and needs a shell to run some commands. Right ?
when the system boots, the only filesystem available for use is / where /sbin resides on.
if you specify a shell residein under /usr for instance, if root can not run any commands prior to this shell loaded, how are you going to mount the filesystem. Do you see the catch-22 situation here ?
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 06:29 AM
08-15-2006 06:29 AM
Re: why root's shell is /sbin/sh?
if i changed the shell of a root, then i cant go to single user mode. that is fine. but, as long as not necessary to go to single user mode, it should function. isnt?
and one more question:
passwd -sa
giving PS and LK.
expand this PS and LK..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 06:31 AM
08-15-2006 06:31 AM
Re: why root's shell is /sbin/sh?
All items in /usr/bin are dynamically linked, which means that in order to run, the /usr/lib area needs to be available.
Now, when the machine starts, it needs to do things via the shell, so it uses the /sbin/sh shell. A lot of the things are done BEFORE any of the other filesystems are mounted, so /usr is NOT available. So if you attempted to use /usr/bin/sh as the shell, it would attempt to access that shell and it would not be available, thus breaking your system.
If you really want to see what happens, find a TEST system, change the shell to /usr/bin/sh, and then reboot the system. Make sure you have a console attached so you can watch the progress and see what happens.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 06:33 AM
08-15-2006 06:33 AM
Re: why root's shell is /sbin/sh?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 06:40 AM
08-15-2006 06:40 AM
Re: why root's shell is /sbin/sh?
1. if i changed the shell for root, system should function properly till the next reboot. isnt?
2. is the system will allow to change the shell for a root? or it wont allow?
3. if a root user mistakenly changed his shell, and system also rebooted then there will be no way to fix the problem. isnt? or there any method is available?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 06:42 AM
08-15-2006 06:42 AM
Re: why root's shell is /sbin/sh?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 06:45 AM
08-15-2006 06:45 AM
Re: why root's shell is /sbin/sh?
TRUE
2. is the system will allow to change the shell for a root? or it wont allow?
Yes, you can change it BUT be prepared for the consequences on reboot.
3. if a root user mistakenly changed his shell, and system also rebooted then there will be no way to fix the problem. isnt? or there any method is available?
There are many methods to fix it. 1) Install your boot disk(s) in another machine, mount them, edit /etc/passwd to change the shell. 2) Boot from recovery media. 3) Reload the OS. ...
There are many ways to "fix" this but it is stupid to ever get in this situation. It usually occurs because somebody from Linux loves bash and "fixes" his HP-UX box. If you are really going to do this then it would be possible to create a stically linked version of a shell but it would still be dumb.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 06:56 AM
08-15-2006 06:56 AM
Re: why root's shell is /sbin/sh?
and passwd -sa
giving PS and LK.
what is this PS and LK?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 07:02 AM
08-15-2006 07:02 AM
Re: why root's shell is /sbin/sh?
A: Yes.
2. is the system will allow to change the shell for a root? or it wont allow?
A: root can do everything (even mistakes) ;-)
3. if a root user mistakenly changed his shell, and system also rebooted then there will be no way to fix the problem. isnt? or there any method is available?
A: The system will give an error "NO SHELL" and cannot execute the init process. It will probably fall back to single user mode and stop there (AFAIR).
Don't change root's shell!
Hope this helps!
Regards
Torsten.
__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.
__________________________________________________
No support by private messages. Please ask the forum!
If you feel this was helpful please click the KUDOS! thumb below!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 07:13 AM
08-15-2006 07:13 AM
Re: why root's shell is /sbin/sh?
PS and LK are values for password status.
PS = valid password
LK = locked account
NP = no password
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 08:08 AM
08-15-2006 08:08 AM
Re: why root's shell is /sbin/sh?
Now if this is a toy system to play with, this may not be much of an issue, but if you depend on this system, never change root's shell. NOTE: it is a common mistake to login as root when it is not required and this leads to all sorts of serious problems including the notorious "rm -rf *" mistake. You don't want any special shell for root -- ever. At most, you'll use root to run maintenance commands and perhaps vi to edit some config files. Otherwise, always avoid logging in as root.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2006 03:48 AM
08-16-2006 03:48 AM
Re: why root's shell is /sbin/sh?
or even better.
When logging in in as root type /usr/bin/ksh, now you are using the korn shell, etc. When you log out you are back to normal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2006 01:03 AM
08-17-2006 01:03 AM
Re: why root's shell is /sbin/sh?
My guess is, they keep /bin/sh because it's smaller and less complex. ksh is good but I've had it crash on hpux more than once.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2006 01:08 AM
08-17-2006 01:08 AM
Re: why root's shell is /sbin/sh?
/sbin is the directory that is available in single-user mode. The only shell that is available in /sbin is sh.
/sbin does NOT have a statically linked version of ksh or any other shell.