chsh is a Unix command used to change a user's login shell, usually by updating the shell entry in account information such as the passwd database. Administrators or users with permission can set which shell starts at logon, which affects available commands, startup files and session behaviour.
What chsh changes in a Unix account
chsh is not a shell itself, it is the account-management command that changes which shell is started when a user logs in. That choice matters because the login shell determines the user’s default command environment, which startup files run, and whether interactive sessions behave as expected for automation, administration, or constrained access.
How chsh fits into Unix account management
On Unix-like systems, the shell entry is typically stored with other identity attributes in account records such as the passwd database. Because of that, chsh sits close to user lifecycle and privilege boundaries rather than application logic. In many environments, only the account owner or an administrator can change it, and policy may restrict which shells are allowed.
This makes chsh a small command with a broad operational effect. Changing the shell can move a user from a restricted or non-interactive environment to a full-featured shell, or the other way around, so the setting is often governed as part of local access administration rather than left to ad hoc preference.
Why the login shell matters for security and operations
The selected shell affects what a user can do after authentication. A more permissive shell may expose richer tooling, additional startup scripts, and a larger attack surface; a restricted shell may limit commands but can also break scripts, remote workflows, or support procedures if the wrong shell is assigned.
Because login shells are part of the session boundary, the choice can influence how administrators separate normal user access from maintenance access. It can also affect forensic clarity: if a shell is changed unexpectedly, logon behavior, command availability, and startup file execution may all differ from the baseline a team expects.
Common pitfalls when changing shells
chsh is often misused when an administrator assumes that changing the shell is a harmless cosmetic preference. In practice, a shell change can disable user workflows, alter environment initialization, or unintentionally grant a more capable command interface than the account should have.
Another common issue is consistency. If shell policy differs across servers, directories, or automation-managed hosts, the same account may behave differently depending on where it authenticates. That inconsistency can complicate support, break scripted logins, and make access reviews less reliable.
When a shell change is intentional, the safe pattern is to treat it as an account control decision, not just a user convenience setting.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
NIST SP 800-53 Rev 5, CIS Controls v8 and NIST CSF 2.0 set the technical controls, while ISO/IEC 27001:2022 defines the regulatory obligations.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev 5 | IA-5 — Authenticator Management | Shell access depends on account credential and lifecycle controls. |
| AC-2 — Account Management | chsh alters an account attribute that governs interactive login behavior. | |
| Recommendation — Review account-level shell changes under IA-5 so access changes stay aligned with credential lifecycle policy. Manage shell assignments as part of AC-2 account provisioning, modification, and disabling. | ||
| CIS Controls v8 | CIS-5 — Account Management | Shell selection is an account administration control tied to authorized access. |
| Recommendation — Apply CIS-5 to govern who can change login shells and to review shell assignments regularly. | ||
| ISO/IEC 27001:2022 | A.5.16 — Identity Management | Login shell settings are an identity attribute that should be governed consistently. |
| Recommendation — Use A.5.16 to control how account identity attributes, including login shells, are assigned and changed. | ||
| NIST CSF 2.0 | PR.AA-01 — Identities and credentials are issued, managed, verified, revoked, and audited | A login shell is part of account access management and should be governed across its lifecycle. |
| Recommendation — Apply PR.AA-01 to ensure shell changes are authorised, traceable, and reviewed. | ||
Practitioner Guidance
Why practitioners should care: chsh changes the interactive boundary for an account, so it should be managed as part of access policy, not as a casual preference update. The main judgment is whether the requested shell aligns with the account’s intended purpose, support model, and privilege level.
What to watch for: Unexpected shell changes, especially on privileged or service-adjacent accounts, can be a sign of policy drift or unauthorized account modification. Review who is permitted to change shells, which shells are allowed, and whether those rules are enforced consistently across systems.
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 9, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org