What is the purpose of /etc/shells?

QuestionsQuestions8 SkillsProUser Account ManagementNov, 16 2025
0140

The /etc/shells file in Unix-like operating systems serves an important purpose related to user shell management. Here’s a concise overview:

Purpose of /etc/shells

  • List of Valid Shells: The /etc/shells file contains a list of valid login shells that users can use. Each line in this file specifies the path to a shell executable.

  • Security: By maintaining this list, the system can restrict users to only those shells that are deemed safe and appropriate for use. This helps prevent users from using non-standard or potentially harmful shells.

  • Shell Change: When a user attempts to change their default shell (using commands like chsh), the system checks if the specified shell is listed in /etc/shells. If it is not listed, the change will be denied.

Example Content

A typical /etc/shells file might look like this:

/bin/sh
/bin/bash
/bin/zsh
/usr/bin/fish

Summary

In summary, the /etc/shells file is crucial for managing user shells, ensuring that only approved shells can be used for user logins, thereby enhancing system security.

If you have any further questions or need clarification, feel free to ask!

0 Comments

no data
Be the first to share your comment!