bad root shell in /etc/passwd
freebsd at dreamchaser.org
Thu Sep 27 04:07:35 UTC 2012
On 09/26/12 19:18, Polytropon wrote:
> 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. :-)
Never run on one enough to learn any of those.
It's a dumbism, too-fast-with-the-fingersism, slow-functioning-brainism...
> That's why you should be using the "toor" account and leave "root"
I realized that about the time I learned I had given root to a bad shell path;
at which time I also realized I hadn't given toor a pw.
> 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. :-)
A (too) faint voice in the back of my head was saying that...
> 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.
That's what I usually do,
but I was (am) having trouble getting .shrc to actually take.
Was modifying passwd to fix my own account,
and decided to "fix" root at the same time --
I had changed it to csh and didn't think that was a good idea.
At first changed it back to /bin/sh,
and then decided to try bash as it should be a super-set.
Although I think that is probably unwise.
> 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.
su -m won't work because of the bad shell
"As a security precaution, if the target user's shell is a non-standard
shell (as defined by getusershell(3)) and the caller's real uid is non-
zero, su will fail."
> 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
chsh and vipw won't work from SUM until you mount /usr,
which fortunately was all intact.
back on the road again, thanks,
More information about the freebsd-questions