Disallow Root Logins | Linux+ Exam XK0-004 | CompTIA

Preventing Root Logins

Question

An administrator is uncomfortable allowing users to log in as root.

Which of the following ensures that root logins are disallowed?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

B.

https://web.mit.edu/rhel-doc/4/RH-DOCS/rhel-sg-en-4/s1-wstation-privileges.html

The correct answer to this question is option C: usermod -B root.

The usermod command in Linux is used to modify user account attributes. The options provided with the usermod command allow an administrator to change various settings related to a user account, such as the username, user ID, group ID, login shell, and more.

In this scenario, the administrator wants to disallow root logins for users. By default, the root account is the most powerful account on a Linux system, with unrestricted access to all files, folders, and system resources. Allowing users to log in as root can be a security risk, as they could potentially perform actions that could compromise the system's security or stability.

To disallow root logins, the -B option is used with the usermod command. The -B option sets the account as "locked," which means that the user cannot log in using that account. In this case, the account being locked is the root account, which ensures that no user can log in as root.

Option A: usermod -L root is incorrect because the -L option is used to lock the user account, not disallow root logins.

Option B: usermod -G root is incorrect because the -G option is used to change the user's primary group membership, not disallow root logins.

Option D: usermod -U root is incorrect because the -U option is used to unlock a locked account, not disallow root logins.