Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Oct 2008 12:29:47 -0700
From:      Jeremy Chadwick <koitsu@FreeBSD.org>
To:        Jerry McAllister <jerrymc@msu.edu>
Cc:        Aniruddha <mailing_list@orange.nl>, freebsd-questions@freebsd.org
Subject:   Re: Can't login as root after changing the shell to bash
Message-ID:  <20081014192947.GB57756@icarus.home.lan>
In-Reply-To: <20081014192024.GA8930@gizmo.acns.msu.edu>
References:  <1224008893.4098.6.camel@debian> <20081014192024.GA8930@gizmo.acns.msu.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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 |




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081014192947.GB57756>