Can't login as root after changing the shell to bash

Jeremy Chadwick koitsu at FreeBSD.org
Tue Oct 14 12:29:52 PDT 2008


On Tue, Oct 14, 2008 at 03:20:24PM -0400, Jerry McAllister wrote:
> On Tue, Oct 14, 2008 at 08:28:13PM +0200, Aniruddha wrote:
> 
> > I tried to change the root's shell to bash. I used this command: 'chsh
> > -s /usr/local/bin/bash'. Prior to changing the shell for root I did it
> > for my user account using the same command without problems.
> > Unfortunately after a reboot I can't login as root anymore because my
> > system can't find /usr/local/bin/bash. How can I fix this? I tried
> > booting the freesbie cd but this wouldn't boot :(. Thanks in  advance!
> 
> Sounds like /usr/local/bin is either not in the path for root or
> that the /usr or /usr/local file system is not mounted - which would
> be true in a single user boot.
> 
> You should never change root's shell.   It is doable if you move
> some files around, but it is too likely that you will come up with
> a situation like this where the alternate shell is not available.
> 
> You can try coming up in 'single user' mode.
> Older systems required you to hit the space bar within the countdown.
> Newer ones require you to select the right option from a menu.  I think
> it is '4' but don't want to reboot at the minute to check.
> 
> It will ask you which shell you want.   Just take the default (eg hit ENTER).
> Then remount /   by doing:    
>   mount -u /
> Then edit /etc/passwd using the vipw(8) utility - just type: 
>   vipw

Note that he'll need to mount /var and /tmp for vi to work.  Has to do
with use of temporary files being placed in /tmp, and recovery files
using /var/tmp/vi.recover.

It's usually best to just do:

# mount -a
# mount -o rw -u /

Which under ideal circumstances should take care of everything.

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |



More information about the freebsd-questions mailing list