Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Sep 2012 22:07:26 -0600
From:      Gary Aitken <freebsd@dreamchaser.org>
To:        Polytropon <freebsd@edvax.de>
Cc:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: bad root shell in /etc/passwd
Message-ID:  <5063D0FE.1080102@dreamchaser.org>
In-Reply-To: <20120927031849.f3496a43.freebsd@edvax.de>
References:  <5063A68A.8090107@dreamchaser.org> <20120927031849.f3496a43.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Thanks, all.

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"
> unchanged.

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
> condition.

chsh and vipw won't work from SUM until you mount /usr,
which fortunately was all intact.

back on the road again, thanks,

Gary



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