Fresh install of Void Linux in a VM. Just the base (installed from net not iso, can't remember the wording now.)
void-live-x86_64-musl-20221001-base.iso
Did not create a user as I'm evaluating for a system where no users log in. (Mentioning that in case there's some quirk that requires a non-root user, which I can create if necessary.)
Noticed TAB did not complete commands. Shell not bash... Ran bash, worked, then used "usermod -s bash root" and rebooted.
Can't login. I know the password is correct.
Been pressing e at grub to init into bash, running passwd there, backing up/editing /etc/ shadow and passwd, nothing works, can't log in.
Any idea what went wrong?
It's a VM (for now) so I could just reinstall, but I want to set bash as my shell without repeating this problem.
Can't login root after changing shell to bash?
-
- Posts: 3
- https://dekodeco.com.pl/producent-mebli-na-wymiar-w-warszawie-nowoczesne-kuchnie/
- Joined: Mon Mar 27, 2023 7:15 pm
Re: Can't login root after changing shell to bash?
I edited /etc/passwd. The shell for root didn't have a full path. I added it (/usr/bin/bash) rebooted and now can log in.
Been using linux ~20 years (mostly full-time 2 years) but I guess you learn something new every day. Never had a problem where it told me "login incorrect" when the problem was something else.
Moral: usermod -s will do what you tell it to (set incomplete path to the shell) but it may not work.
Been using linux ~20 years (mostly full-time 2 years) but I guess you learn something new every day. Never had a problem where it told me "login incorrect" when the problem was something else.
Moral: usermod -s will do what you tell it to (set incomplete path to the shell) but it may not work.
Re: Can't login root after changing shell to bash?
Glad you got it sorted.
FWIW, every *NIX/BSD system I have ever used, I had to provide the full path for the shell using useradd/usermod.
By default, Void uses DASH for root and BASH for any other user as DASH is a smaller footprint with fewer exploitable features - i.e. somewhat more secure for the Root account than most other shells.
I, too, had switched the root account to BASH for the same reasons you mentioned, but got in the habit of never logging in as or using su to become root. Instead I just use doas or sudo whenever I need root privileges and is the recommended method of performing any actions as root. I doubt this is new information to you as you've been using Linux as long as myself, yet I still only recently switched to this "more secure" method.
Regarding doas vs sudo, I also extremely recently switched to doas over sudo (less than 2 months) after the recent sudo CVE that came to light and doas being far simpler to configure.
FWIW, every *NIX/BSD system I have ever used, I had to provide the full path for the shell using useradd/usermod.
By default, Void uses DASH for root and BASH for any other user as DASH is a smaller footprint with fewer exploitable features - i.e. somewhat more secure for the Root account than most other shells.
I, too, had switched the root account to BASH for the same reasons you mentioned, but got in the habit of never logging in as or using su to become root. Instead I just use doas or sudo whenever I need root privileges and is the recommended method of performing any actions as root. I doubt this is new information to you as you've been using Linux as long as myself, yet I still only recently switched to this "more secure" method.
Regarding doas vs sudo, I also extremely recently switched to doas over sudo (less than 2 months) after the recent sudo CVE that came to light and doas being far simpler to configure.
Daily Void Linux user since 2015. Desktops, laptops, NAS Gluster cluster, and many virtual machines. It can do it all.
Re: Can't login root after changing shell to bash?
I don't think I've ever actually changed a user's default shell. For most distros it's bash or some shell that supports auto-complete. But I understand defaulting to something more minimal/secure than bash could be good.
What threw me (that I didn't explicitly say in my original post) is that the error after entering password said something like "invalid login," not "I can't find that shell, you dummy."

I was evaluating Void Linux (and other distros) for a specific application, a router actually, on an x86_64 mini-pc with multiple ethernet ports. But I've made a lot of progress with another distro (router working with dnsmasq/nftables,) so probably won't be back here much.