fbpx

Understanding the /etc/shells file

· >

Understanding the /etc/shells File

The /etc/shells file is an important component within the Linux operating system as regards user administration and security. It stores information about the available command interpreters, or shells, on the system and is consulted by the chsh command in order to determine the valid login shells.

What is the /etc/shells File?

The /etc/shells file is a plain text file that contains a list of all valid shells recognized by the system. It is commonly used when the system administrator wants to limit the access of users to only certain shells.

Structure of the /etc/shells File

The /etc/shells file has a simple structure. It consists of only one line per shell, with each line containing the path to each shell available on the system. As an example, the default /etc/shells file may look like this:

  • /bin/sh
  • /bin/bash
  • /sbin/nologin
  • /usr/bin/sh
  • /usr/bin/bash

These paths signify that /bin/sh, /bin/bash, /sbin/nologin, /usr/bin/sh, and /usr/bin/bash are the shells available to be used on this system.

The /etc/shells file is consulted by the chsh command (which stands for change shell) when running the command to change a user’s default login shell. The shell that is being changed must be listed in /etc/shells in order for the change to be accepted.

Editing the /etc/shells File

The /etc/shells file can be edited with any text editor available on the system. It is important to note, however, that the /etc/shells file is only writable by the root user, so one should use the sudo command to execute tasks with elevated privileges when making changes to the file.

Once the /etc/shells file has been modified, the updated command interpreters will become available to all users on the system. The chsh command will also only accept newly added shells for the users’ default login shell.

Conclusion

In conclusion, the /etc/shells file plays an important role in user administration and security of a Linux system. It is accessible by the chsh command, which is used to change a user’s default login shell. As the file is only writable by the root user, it is important to execute tasks with elevated privileges in order to make any changes to it.

Leave a Reply

Your email address will not be published. Required fields are marked *

© Copyright Tech Academy
All Rights Reserved.
ENROLL IN CISCO ACADEMY

 Get CCNA Discount Voucher