I'm trying to change the default shell for my user. But I keep getting this error:
$ chsh
You may not change the shell for 'flimm'.
$ chsh -s "$(which bash)"
You may not change the shell for 'flimm'.
I'm trying to understand why I may not change the shell for my user.
Since you confirmed that
/usr/bin/chsh
is setuid root (and therefore should allow non-privileged users to change their own login shell), the most likely explanation for this behavior is that eitheror
/bin/rbash
)Ex.
Note that there is no restriction on root setting a user's login shell to an invalid shell (as here), and doing so does not make an invalid shell valid by adding it to the /etc/shells file.
If the target shell was absent from the /etc/shells file, you would have received a different message:
You can try with command sudo usermod -s /bin/bash flimm
The user's login shell is kept in
/etc/passwd
, and is protected from modification by regular users. You can see it withgetent passwd $USER
.If your new shell is listed in
/etc/shells
, you can change it with:As with all manipulations of login info, be sure to have a login session on another terminal (Ctrl-Alt-F3) in case you break something and can't login.