1845729 Members
3932 Online
110249 Solutions
New Discussion

Changing Root's Shell

 
SOLVED
Go to solution
Achilles_2
Regular Advisor

Changing Root's Shell

Hi all,

My server model:
ia64 hp server rx2600

OS version:
B.11.23

I give root a REAL ksh shell at bootup, so I change the "/sbin/sh" line for root in the /etc/passwd file to "/sbin/ksh" then do this:
cp -p /usr/bin/ksh /sbin/ksh

Also I create the file /etc/shells with the access permissions 664, the content includes:
/bin/ksh
/sbin/ksh
/sbin/sh
/usr/bin/ksh
/usr/bin/rksh
/usr/bin/sh

Finally, it failed to execute the following command:

/sbin/ksh: tis4: not found

which tis4 represents:
alias tis4="rlogin tiscmcs4 -l root" in .kshrc file.

Thanks you for your helps
Alex
12 REPLIES 12
Michael Tully
Honored Contributor

Re: Changing Root's Shell

There is one very big problem with the logic, the 'root' account *MUST* have /sbin/sh as it's shell. No if's or but's *MUST*
Your system can be rendered fairly useless without it. There are a zillion posts on this subject.
Anyone for a Mutiny ?
Michael Tully
Honored Contributor
Solution

Re: Changing Root's Shell

A. Clay Stephenson
Acclaimed Contributor

Re: Changing Root's Shell

First of all, you didn't need to change root's shell at all. It is a fully functional version of the POSIX shell and except for very esoteric differences it is a Korn shell - a superset, in fact. Secondly, if you did change root shell to something else you must create a statically linked version. That is the difference between /sbin/sh and /usr/bin/sh. They are functionally equivalent but there is an iportant distinction. /sbin/sh will execute as a standalone program but the /usr/bin version won't because it relies upon shared library code in /usr. Now ask yourself, how are you going to execute a shell to mount /usr unless the shell itself doesn't require /usr?

If it ain't broke, I can fix that.
Steven E. Protter
Exalted Contributor

Re: Changing Root's Shell

DON'T change it.

If you persist, I would suggest updating the reasume.

Root needs its default shell. If you made the change, put it back before you boot the machine.

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
Patrick Wallek
Honored Contributor

Re: Changing Root's Shell

Do NOT reboot your machine until you change the shell back to /sbin/sh in /etc/passwd. If you do reboot it is VERY likely that your machine won't boot.

As has been said above the root account ABSOLUTELY MUST have /sbin/sh as its shell.

If you insist on using something do:

# exec /usr/bin/ksh

AFTER you log in to the system as root. Don't put it in your .profile or anything just execute that command at the command line. Now you have ksh.

KapilRaj
Honored Contributor

Re: Changing Root's Shell

NEVER ................

Kaps
Nothing is impossible
Joseph Loo
Honored Contributor

Re: Changing Root's Shell

hi,

look at the "uproar" u have cause, all the warnings are out. please do what u have to do to avoid a major problem with your server.

regards.
what you do not see does not mean you should not believe
Achilles_2
Regular Advisor

Re: Changing Root's Shell

I have checked that the path isn't same as other server.

root@tisdev:/ # which ksh
/usr/bin/ksh
root@tisdev:/ # which tar
/usr/bin/tar

root@GZDT-2:/.root # which ksh
/bin/ksh
root@GZDT-2:/.root # which tar
/bin/tar

How can I solve it ?
Alex
Achilles_2
Regular Advisor

Re: Changing Root's Shell

I mean that /usr/bin/ksh is correct path.
I want to change /bin/ksh path to the correct one.
Robert-Jan Goossens
Honored Contributor

Re: Changing Root's Shell

Hi Alex,

Check your PATH env variables on both servers.

# echo $PATH

should be /usr/bin not /bin

Hope this helps,
Robert-Jan
Achilles_2
Regular Advisor

Re: Changing Root's Shell

Thanks all your helps
The problem is solved out!!!

Regards
Alex
Kent Ostby
Honored Contributor

Re: Changing Root's Shell

Alex --
/bin is linked to /usr/bin so that is why you will see similar things.

If you want ksh then the easiest way to do this correctly is to set up a second root user .. call it "root2" or whatever and give that user the ksh. Make sure the user has uid 0 just like root.

Then when you log in as root and want ksh, do a su - root2.

Best regards,

Kent M. Ostby
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"