bad root shell in /etc/passwd
freebsd at edvax.de
Thu Sep 27 01:18:57 UTC 2012
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
> Or will it fall back to /bin/sh?
No, you will be prompted for the shell to be executed.
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.
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions