View previous topic :: View next topic |
Author |
Message |
Uzytkownik Guru
Joined: 31 Oct 2004 Posts: 399 Location: Bay Area, US
|
Posted: Thu Feb 04, 2010 11:43 am Post subject: 2 shells for root |
|
|
Hello.
I'd like to have 2 shells for root. One is zsh for such tasks as installing new software etc. However in case of emergency - when for example /usr is not mounted - I prefere to have bash.
Is it possible to set bash as rescue shell - i.e. when admin intervention is requested after failed fsck or in interactive boot mode? _________________ I've probably left my head... somwhere. Please wait untill I find it. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54317 Location: 56N 3W
|
Posted: Thu Feb 04, 2010 12:59 pm Post subject: |
|
|
Uzytkownik,
Yes. Copy your boot stanza in /boot/grub.grub.conf and rename the copy to Rescue.
On the end of the kernel line in the Rescue add init=/bin/bash or whatever shell you would like.
When you boot this option, the system comes up very fast as the kernel just runs the shell.
There are no services running, only root / is mounted and there is no environment set.
Its just the kernel and your shell.
if you want it to work when glibc is broken, you need to build your chosen shell statically, busybox is a favorite for this. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
Uzytkownik Guru
Joined: 31 Oct 2004 Posts: 399 Location: Bay Area, US
|
Posted: Thu Feb 04, 2010 1:09 pm Post subject: |
|
|
NeddySeagoon wrote: | Uzytkownik,
Yes. Copy your boot stanza in /boot/grub.grub.conf and rename the copy to Rescue.
On the end of the kernel line in the Rescue add init=/bin/bash or whatever shell you would like.
When you boot this option, the system comes up very fast as the kernel just runs the shell.
There are no services running, only root / is mounted and there is no environment set.
Its just the kernel and your shell.
if you want it to work when glibc is broken, you need to build your chosen shell statically, busybox is a favorite for this. |
Sorry - I know this trick and... well I already have rescue entry in grub with this parameter. I asked more about shell spawn during boot. _________________ I've probably left my head... somwhere. Please wait untill I find it. |
|
Back to top |
|
|
Mike Hunt Watchman
Joined: 19 Jul 2009 Posts: 5287
|
Posted: Thu Feb 04, 2010 4:48 pm Post subject: |
|
|
Create a new user account with the other shell as default, login and su. |
|
Back to top |
|
|
desultory Bodhisattva
Joined: 04 Nov 2005 Posts: 9410
|
Posted: Fri Feb 05, 2010 10:28 am Post subject: |
|
|
You could set the default shell to bash, have it check for /usr/ being mounted and whatever other conditions and if it seems to not be some anticipated form of emergency start zsh with exec. |
|
Back to top |
|
|
Jaglover Watchman
Joined: 29 May 2005 Posts: 8291 Location: Saint Amant, Acadiana
|
Posted: Fri Feb 05, 2010 11:42 am Post subject: |
|
|
In FreeBSD it is recommended to create another user toor with root privileges:
Code: | root:*:0:0:Charlie &:/root:/bin/csh
toor:*:0:0:Bourne-again Superuser:/root:/usr/local/bin/bash
|
Any reason one cannot do it in Linux? |
|
Back to top |
|
|
desultory Bodhisattva
Joined: 04 Nov 2005 Posts: 9410
|
Posted: Fri Feb 05, 2010 11:58 am Post subject: |
|
|
Some, badly implemented, utilities specifically check for the name "root", though that is not exactly specific to Linux. Aside from that it should work. |
|
Back to top |
|
|
Uzytkownik Guru
Joined: 31 Oct 2004 Posts: 399 Location: Bay Area, US
|
Posted: Fri Feb 05, 2010 12:19 pm Post subject: |
|
|
Ok. Thanks. _________________ I've probably left my head... somwhere. Please wait untill I find it. |
|
Back to top |
|
|
|