Forrest logo
back to the chsh tool

nologin:tldr:73db6

nologin: Set a user's login shell to `nologin` to prevent the user from logging in.
$ chsh -s ${user} nologin
try on your machine

The command chsh -s ${user} nologin is used to change the login shell for a particular user to nologin. Here is the breakdown of the command:

  • chsh: It stands for "change shell" and is a command-line utility in Unix-like systems used to change the default login shell for a user.

  • -s ${user}: This option is used to specify the new shell for the user. ${user} is a placeholder variable that needs to be replaced with the actual username.

  • nologin: It is a shell provided by most Unix-like systems that prevents the user from logging in. When set as the login shell for a user, it effectively disables their ability to access the system through interactive login methods like SSH or the terminal.

In summary, the command chsh -s ${user} nologin changes the login shell for the specified user to nologin, preventing them from logging in interactively.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the chsh tool