chsh

Linux · Users and permissions · reference only

What it does

Changes an account's login shell. It only accepts shells listed in /etc/shells.

Syntax

chsh [opciones] [usuario]

Options and parameters

  • -s shell

    Sets the login shell.

  • -l

    Lists the allowed shells in /etc/shells.

  • -h

    Shows help and exits.

  • -V

    Shows the version and exits.

  • usuario

    Account to modify; only root can change other users'.

Usage examples

  • chsh -l

    Shows which shells you can choose.

  • chsh -s /bin/zsh

    Changes your shell to zsh from the next login.

  • sudo chsh -s /bin/bash ana

    As root, changes the shell of the ana account.

  • getent passwd ana | cut -d: -f7

    Checks the shell registered for ana.

Notes and common mistakes

  • The change applies at the next login, not in the open session.
  • If the shell is not in /etc/shells the command rejects it.

Related commands