To change a password in Linux, whether it's for the root user or any other user, follow these steps:

1. Log in to the Linux system as the user whose password you want to change or log in as the root user.

2. Open a terminal or command prompt.

3. Type the following command to change the password for the current user:


passwd

If you want to change the password for another user, use the following command instead:


sudo passwd username

Replace "username" with the actual username of the user whose password you want to change.

4. You will be prompted to enter the current password for the user. If you are changing the root password, you may not be prompted for the current password.

5. Next, you will be prompted to enter the new password. Type the new password and press Enter. Make sure your password is strong and secure.

6. You will be prompted to re-enter the new password to confirm it. Type the new password again and press Enter.

7. If the password change is successful, you will receive a confirmation message.

By following these steps, you can change the password for any user on a Linux system, including the root user. It is recommended to change your passwords regularly to ensure the security of your system.

這篇文章有幫助嗎? 15 Users Found This Useful (43 Votes)