/ devops

Changing default shell for a non-root user on your Linux server without being asked for a password

When running /usr/bin/chsh -s $(which zsh), chsh asked for a password, but there's no password for my current user. If running this using sudo, root's default shell gets changed.

Simple & fast solution: add the following line to the top of /etc/pam.d/chsh

auth       sufficient   pam_shells.so

If there's auth required pam_shells.so, change required to sufficient.

(I personally suggest to revert the changes to /etc/pam.d/chsh after you finished changing the shell)

Birkhoff Lee

Birkhoff Lee

I'm Birkhoff Lee, a developer since the age of 7. I'm still learning cyber security and site reliability engineering. Recently having Harvard CS50.

Read More