How to change the default shell on Fedora Silverblue? chsh is not available

I’ve tried to change the default Linux console on Fedora Silverblue (30) with the usual chsh, but that was not even installed! I also could not find any package to install via rpm-ostree or so.

So how can I change the default login shell on Fedora Silverblue?

I’ve found potential workarounds that allow to change the login shell of any other user, but IMHO, this is no really clean solution.

So why is not chsh available on Silverblue?

1 Like

Install util-linux-user to get chsh

[returntrip@silverblue30 ~]$ toolbox run dnf provides chsh
Last metadata expiration check: 0:07:04 ago on Sun 07 Jul 2019 20:28:11 CEST.
util-linux-user-2.33.2-1.fc30.x86_64 : libuser based util-linux utilities
Repo        : fedora
Matched from:
Filename    : /usr/bin/chsh
2 Likes

Okay, funny, I need to get used to that dnf provides command as it seems… :wink:

However, the question is if it is worth to layer this small Linux utility just to change your shell. (After all, you usually only do so once.) And layering involves a restart etc. Just to change your shell, this could be a little too much. (Even… or especially, if you then uninstall it afterwards.)

The question is, does it do something more than just edit /etc/passwd? If not, then I can also edit that manually.
Or e.g. run preinstalled usermod like this, as I now did:

usermod -s /bin/bash $USERNAME
1 Like

Not sure if it changes anything more than usermod --shell <shell> <user> but I guess it does not.

1 Like

In this thread @refi64 actually presented the “real” Silverblue solution:

Fedora intentionally doesn’t include chsh because it’s setuid root which is a bit of a security rabbit hole, use sudo lchsh $USER .

I’ve tested it and it works flawlessly! :smiley:

5 Likes

Well, actually @refi64’s solution does not seem to work anymore even sudo lchsh does not work anymore in recent Silverblue (Fedora Silverblue 33):

$ sudo chsh $USER
sudo: chsh: command not found

This previously mentioned usermod command does work though:

$ sudo usermod -s /bin/bash $USERNAME
4 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.