{
    "mode": "man",
    "parameter": "CHSH",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/CHSH/1/json",
    "generated": "2026-06-12T09:53:54Z",
    "synopsis": "chsh [options] [LOGIN]",
    "sections": {
        "NAME": {
            "content": "chsh - change login shell\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "chsh [options] [LOGIN]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The chsh command changes the user login shell. This determines the name of the user's initial\nlogin command. A normal user may only change the login shell for her own account; the\nsuperuser may change the login shell for any account.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "The options which apply to the chsh command are:\n",
            "subsections": [
                {
                    "name": "-h --help",
                    "content": "Display help message and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-R --root",
                    "content": "Apply changes in the CHROOTDIR directory and use the configuration files from the\nCHROOTDIR directory.\n",
                    "flag": "-R",
                    "long": "--root"
                },
                {
                    "name": "-s --shell",
                    "content": "The name of the user's new login shell. Setting this field to blank causes the system to\nselect the default login shell.\n\nIf the -s option is not selected, chsh operates in an interactive fashion, prompting the user\nwith the current login shell. Enter the new value to change the shell, or leave the line\nblank to use the current one. The current shell is displayed between a pair of [ ] marks.\n",
                    "flag": "-s",
                    "long": "--shell"
                }
            ]
        },
        "NOTE": {
            "content": "The only restriction placed on the login shell is that the command name must be listed in\n/etc/shells, unless the invoker is the superuser, and then any value may be added. An account\nwith a restricted login shell may not change her login shell. For this reason, placing\n/bin/rsh in /etc/shells is discouraged since accidentally changing to a restricted shell\nwould prevent the user from ever changing her login shell back to its original value.\n",
            "subsections": []
        },
        "FILES": {
            "content": "/etc/passwd\nUser account information.\n\n/etc/shells\nList of valid login shells.\n\n/etc/login.defs\nShadow password suite configuration.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "chfn(1), login.defs(5), passwd(5).\n\n\n\nshadow-utils 4.8.1                           02/06/2024                                      CHSH(1)",
            "subsections": []
        }
    },
    "summary": "chsh - change login shell",
    "flags": [
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display help message and exit."
        },
        {
            "flag": "-R",
            "long": "--root",
            "arg": null,
            "description": "Apply changes in the CHROOTDIR directory and use the configuration files from the CHROOTDIR directory."
        },
        {
            "flag": "-s",
            "long": "--shell",
            "arg": null,
            "description": "The name of the user's new login shell. Setting this field to blank causes the system to select the default login shell. If the -s option is not selected, chsh operates in an interactive fashion, prompting the user with the current login shell. Enter the new value to change the shell, or leave the line blank to use the current one. The current shell is displayed between a pair of [ ] marks."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "chfn",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/chfn/1/json"
        },
        {
            "name": "login.defs",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/login.defs/5/json"
        },
        {
            "name": "passwd",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/passwd/5/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Change user's login shell.",
        "examples": [
            {
                "description": "Set a specific login shell for the current user interactively",
                "command": "chsh"
            },
            {
                "description": "List available shells",
                "command": "chsh {{-l|--list-shells}}"
            },
            {
                "description": "Set a specific login shell for the current user",
                "command": "chsh {{-s|--shell}} {{path/to/shell}}"
            },
            {
                "description": "Set a login shell for a specific user",
                "command": "sudo chsh {{-s|--shell}} {{path/to/shell}} {{username}}"
            }
        ]
    }
}