Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Sep 2012 03:18:49 +0200
From:      Polytropon <freebsd@edvax.de>
To:        freebsd@dreamchaser.org
Cc:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: bad root shell in /etc/passwd
Message-ID:  <20120927031849.f3496a43.freebsd@edvax.de>
In-Reply-To: <5063A68A.8090107@dreamchaser.org>
References:  <5063A68A.8090107@dreamchaser.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 26 Sep 2012 19:06:18 -0600, Gary Aitken wrote:
> I mistakenly changed the root shell to something which doesn't exist.
> Was trying to make it bash and used /bin/bash instead of /usr/local/bin/bash.

A typical Linuxism. :-)



> As a consequence, all login attempts fail because the shell can't be found.

That's why you should be using the "toor" account and leave "root"
unchanged. Some may say that as soon as you're changing the root
shell because you're doing much work as root, you're obvuously
doing something wrong. :-)

Also note that tools like su ("su -m", "su -") and super are
in many cases better suited for making the CLI environment more
comfortable than changing the shell of the root account.



> Unfortunatley, I shut down the session in which I modified /etc/passwd and
> I don't have a root shell running anywhere, so I can't fix it.

Maybe without rebooting you can do this: Enter "su -m" (if your
non-root user is allowed to su root, then enter "chsh" and set
the root shell back to the default.



> I'm concerned that booting single user will have the same problem.

When you can successfully boot into SUM, you will be prompted for
the shell to start. /bin/sh is the default shell (even though it
is a quite ugly dialog shell -- still it's considered a "maintenance
and emergency use only shell" at this point. It will be powerful
enough to call the "chsh" command to get root back into normal
condition.



> Or will it fall back to /bin/sh?

No, you will be prompted for the shell to be executed.



> guidance?

Try the "su -m" trick first. If it doesn't work:

Reboot into SUM, and at the

	Enter full pathname of shell or RETURN for /bin/sh:

prompt, press RETURN. In worst case (e. g. if you have accidentally
damaged /bin/sh, maybe by overwriting it with a dynamically
linked bash), you could type "/rescue/sh" instead.




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



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