Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
2 shells for root
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Uzytkownik
Guru
Guru


Joined: 31 Oct 2004
Posts: 399
Location: Bay Area, US

PostPosted: Thu Feb 04, 2010 11:43 am    Post subject: 2 shells for root Reply with quote

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
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54317
Location: 56N 3W

PostPosted: Thu Feb 04, 2010 12:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
Uzytkownik
Guru
Guru


Joined: 31 Oct 2004
Posts: 399
Location: Bay Area, US

PostPosted: Thu Feb 04, 2010 1:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
Mike Hunt
Watchman
Watchman


Joined: 19 Jul 2009
Posts: 5287

PostPosted: Thu Feb 04, 2010 4:48 pm    Post subject: Reply with quote

:idea: Create a new user account with the other shell as default, login and su. :?:
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Fri Feb 05, 2010 10:28 am    Post subject: Reply with quote

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
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Fri Feb 05, 2010 11:42 am    Post subject: Reply with quote

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
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Fri Feb 05, 2010 11:58 am    Post subject: Reply with quote

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
View user's profile Send private message
Uzytkownik
Guru
Guru


Joined: 31 Oct 2004
Posts: 399
Location: Bay Area, US

PostPosted: Fri Feb 05, 2010 12:19 pm    Post subject: Reply with quote

Ok. Thanks.
_________________
I've probably left my head... somwhere. Please wait untill I find it.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum