Linux Server Access Recovery: Regain and Reset Root Password | XK0-004 Exam Preparation

Recovering and Resetting Root Password on a Linux Server | XK0-004 Exam

Question

A Linux server needs to be accessed, but the root password is not available.

Which of the following would BEST allow an administrator to regain access and set a new known password at the same time?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

A.

https://phoenixnap.com/kb/how-to-change-root-password-linux

The BEST way to regain access to a Linux server and set a new password when the root password is not available is to boot into single-user mode and reset the password via the passwd command.

Single-user mode is a special boot mode in Linux that allows the system to be booted into a minimal environment with only essential services running. This mode does not require a password to log in, and it provides a way to perform system maintenance tasks, such as resetting the root password.

Option B, editing the /etc/passwd file, is not recommended as it requires a specific format, and an error in the file could render the system unusable.

Option C, editing the /etc/shadow file, is also not recommended because the /etc/shadow file contains encrypted passwords, and editing this file without proper knowledge can cause the system to become unusable.

Option D, resetting the password via the chage command, is not a reliable method as it only changes the password expiration date rather than resetting the password itself.

Therefore, option A, resetting the password via the passwd command in single-user mode, is the BEST way to regain access to the Linux server and set a new password.