What file would you modify to change the default shell for a user?

Study for the LPI Linux Essentials Exam. Study with flashcards and multiple choice questions, each question has hints and explanations. Get ready for your exam!

Multiple Choice

What file would you modify to change the default shell for a user?

Explanation:
To change the default shell for a user, the appropriate file to modify is the /etc/passwd file. This file contains essential information about user accounts, including the username, user ID, group ID, home directory, and the default shell for each user. The default shell is specified at the end of each line corresponding to a user. When editing /etc/passwd, you can replace the current shell path with the path to the new shell that you wish to set as the default for the user. For example, if you wanted to change a user's default shell from /bin/sh to /bin/bash, you would locate their entry in /etc/passwd and update the last field of that line accordingly. The other options do not serve the purpose of changing a user's default shell. /etc/shells lists valid login shells that the system recognizes, /usr/local/bin is a directory typically used for locally installed executable files and does not directly relate to user settings, and /home/user/.bashrc is a configuration file specific to the user's shell environment but does not change the default shell itself.

To change the default shell for a user, the appropriate file to modify is the /etc/passwd file. This file contains essential information about user accounts, including the username, user ID, group ID, home directory, and the default shell for each user. The default shell is specified at the end of each line corresponding to a user.

When editing /etc/passwd, you can replace the current shell path with the path to the new shell that you wish to set as the default for the user. For example, if you wanted to change a user's default shell from /bin/sh to /bin/bash, you would locate their entry in /etc/passwd and update the last field of that line accordingly.

The other options do not serve the purpose of changing a user's default shell. /etc/shells lists valid login shells that the system recognizes, /usr/local/bin is a directory typically used for locally installed executable files and does not directly relate to user settings, and /home/user/.bashrc is a configuration file specific to the user's shell environment but does not change the default shell itself.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy