The shell is a program that interprets commands that we enter and there are several shells such as bash, sh, ksh, zsh, fish and many more. Bash (/bin/bash
) is a popular shell on most if not all Linux systems, and it’s normally the default shell for user accounts.
We can also change or define a shell for a user to provide more functionality or block access to the shell using /sbin/nologin
.
A list of shells can be found in the /etc/shells file which can be used to define the shell for users, so make sure the /sbin/nologin
binary exists and it is listed in the /etc/shells file. Then use usermod
to change a user's shell:
usermod --shell <Shell> <Username>
We can also change the user's shell directly by editing /etc/passwd file.