Changing a login shell changes the program that starts when a local user opens a new login session. It affects SSH logins, virtual consoles, and terminal sessions that begin as login shells, so the account should point to an installed shell that the system accepts before the user signs out.

Linux records each local account's login shell in the final field of its passwd database entry. The chsh command updates that field through the account-management tools instead of editing /etc/passwd by hand. The shell path should be the full executable path, such as /usr/bin/zsh, not only the shell name.

The current terminal does not switch shells just because the account entry changed. Keep an existing administrator session open until a new login proves the selected shell starts correctly, especially on remote systems where an invalid shell can stop the account from opening a normal session.

Steps to change the default shell in Linux:

  1. Check the current login shell for the target account.
    $ getent passwd audituser
    audituser:x:1001:1001::/home/audituser:/bin/bash

    The last field in the passwd entry is the configured login shell for the account.

  2. Resolve the full path to the new shell.
    $ command -v zsh
    /usr/bin/zsh

    Install the shell with the system package manager if this command prints nothing. On Debian and Ubuntu, use sudo apt install --assume-yes zsh for Zsh.

  3. Confirm the shell is listed as a valid login shell.
    $ cat /etc/shells
    # /etc/shells: valid login shells
    /bin/sh
    /usr/bin/sh
    /bin/bash
    /usr/bin/bash
    /bin/rbash
    /usr/bin/rbash
    /usr/bin/dash
    /bin/zsh
    /usr/bin/zsh

    Use a shell path from /etc/shells for normal accounts. A path that is missing, misspelled, or blocked by local policy can prevent future logins.

  4. Change the login shell for the account.
    $ sudo chsh --shell /usr/bin/zsh audituser

    Replace audituser with the local account that needs the change. A normal user can usually change only their own account, while root can change another local account.

  5. Verify that the account database now references the new shell.
    $ getent passwd audituser
    audituser:x:1001:1001::/home/audituser:/usr/bin/zsh
  6. Start a new login session as the target account.

    Sign out and back in, reconnect over SSH, or open a separate login session. The old terminal process keeps its original shell.

  7. Confirm the new login session starts the selected shell.
    $ printf 'SHELL=%s\nargv0=%s\n' "$SHELL" "$0"
    SHELL=/usr/bin/zsh
    argv0=-zsh

    The leading hyphen in argv0=-zsh indicates that Zsh started as a login shell.