1828225 Members
3498 Online
109975 Solutions
New Discussion

Re: root shell

 
Tarek_1
Frequent Advisor

root shell

Hi,
i want to change the root shell password from /sbin/sh to /bin/ksh
is it possible?
what impact does it have?
thanks
Tarek
8 REPLIES 8
Goran Koruga
Honored Contributor

Re: root shell

Hi.

Of course it's possible, whether it's a good idea is another question.

It would probably be better to use /bin/sh and then start ksh from your .profile or manually.

G.
Donald Kok
Respected Contributor

Re: root shell

Tarek,

No you should not do this! When you want to login in single user mode, your filesystems are not mounted, and you will not get a shell.

You can put ksh in your .profile, so you can use ksh.

Greetzz
Donald
My systems are 100% Murphy Compliant. Guaranteed!!!
Tarek_1
Frequent Advisor

Re: root shell

ok
i have my root shell /sbin/sh and created a .profile under my home dir (but this is also read by sh)
then i issue ksh but it doesn't read my configuration file (.profile)
why?
Goran Koruga
Honored Contributor

Re: root shell

Because it's not a login shell.

G.
Ramkumar Devanathan
Honored Contributor

Re: root shell

Hi Tarek,

Normally the /sbin/sh binary is compiled with all the libraries statically linked. So, it will run even when the OS boots in single user mode.

ksh may have some dynamic linking so.s built in and so, you wouldn't want to use this.

login with kshell as a non-root user.

Thereafter to work as root,
run

$ su

- ramd.
HPE Software Rocks!
Tarek_1
Frequent Advisor

Re: root shell

i'm already loggin in as a ksh user and then issuing su but doesn't work
let's say after i switch to root
i want to run a script that sets my env variables:
user> su
#> ksh
#> ./setup
this setup is the script i want to run and inside i have:
set -o vi
alias ll='ls -lart'
PS1=...
and so on..
how should i do?
Goran Koruga
Honored Contributor

Re: root shell

Hi Tarek.

ksh should read the file pointed at by ENV variable, i.e. ~/.kshrc or so.

G.
Stuart Browne
Honored Contributor

Re: root shell

What has been said about just launcing 'ksh' thus far is almost correct.

Whilst 'ksh' isn't being launched from 'login' directly, and doesn't think it needs to read '~/.profile', you can tell ksh that it is a login shell by passing the argument '-l'.

If you read 'man ksh', it will outline what this does and doesn't do..

One other note, so you dont have to double 'exit' when you leave the shell, instead of just calling '/bin/ksh' as the last line of your login, use 'exec /bin/ksh'. This will switch the control of the tty to the ksh process. When it ends, it closes off everything, and logs you out.
One long-haired git at your service...