Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change root shell

Status
Not open for further replies.

7280

MIS
Apr 29, 2003
331
IT
Hi,
i've been told to never change root's shell directory because in case of failure i will not be able to boot in single user mode.
So i want to use ksh for user root. I want that, when i log in as root, i can run a script that sets me ksh and some aliases.
I create a .profile and put inside following commands:
ksh
set -o vi
alias ll='ls -lart'
but i'm having erros. So every time i enter as root i issue
these commands manually. Can you help me create a scripts that i can run when i login and sets for me ksh and env variables?
Thanks
 
What kind of errors are you getting? Have you overwritten the default .profile with your file or just edited it to include the above?
 
By default there is no default .profile.
What i did is create a .profile and add to them "my" settings.
My .profile is without first two lines and all .profile is executed correctly. If i add ksh at beginning all other variables aren't set.

ksh
set -o vi
echo""
banner `hostname`
echo""
echo "WARNING: you are SUPER-USER !!"
echo""
PS1="ROOT@`hostname` $ "
PATH=$PATH:/usr/local/bin:/usr/local/sbin:/opt/netscape:
 
revert to root's original .profile

add the following line:-

ENV=~/.kshrc

in .profile

create .kshrc in root's home directory

put all the ksh specific commands in .kshrc

login as root

ksh





 
just change the root entry default shell in the passwd file to /bin/ksh. that's the standard shell for root in the hp and sun world anyway. then just create a /.profile with your stuff. the reason people say to NEVER change root's default shell is because it's shocking how often people screw it up. my rule of thumb is never change root's default shell to a link. so if /bin/ksh is actually a link to /usr/bin/ksh i'll use /usr/bin/ksh. usually this not an issue but some unix machines are picky. if you're really nervous about it you can change it and before you log out from the changing session rlogin from another machine and see how it works. if it does you're good to go. once you place a ksh in the .profile you actually enter a new shell environ and all subsequent lines in the .profile don't get passed to the 'new' shell.
 
I copied original /etc/skel/.profile under /.profile and added ENV=/.kshrc in it. Then created /.kshrc and added following lines:
set -o vi
echo""
banner `hostname`
echo""
echo "WARNING: you are SUPER-USER !!"
echo""
PS1="ROOT@`hostname` $ "
PATH=$PATH:/opt/netscape:.

Then logout and login and issued ksh but nothing changed. All my variables aren't set.
 
I know i can modify the passwd but i have been told this is dangerous when booting in single-user mode.
 
Don't you need to have an "export ENV" line in .profile too.
 
You're right!! Today it's better i stop working.
I'm making a lot of confusion and errors!
However thanks very much all you for help.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top