![]() ![]() ![]() The last password change and password expiration date show which users haven’t updated their passwords recently and when they need to change them. Use the following command to see the content of /etc/shadow: cat /etc/shadow In the shadow file, you will be able to see the encrypted user passwords, SSH key ownership, and other related information such as the last password change and password expiration date. The second Linux file strongly related to passwords is /etc/shadow. Use the following command to see the content of /etc/passwd: cat /etc/passwd The first is /etc/passwd, which contains all the users’ information, including the encrypted password, group ID, and home directory. Password management in Linux involves two important files. Now that the user edward has the same password as user leon, use the passwd command to set a new one: sudo passwd edwardĮnter the temporary password, and the terminal will prompt you to set a new password for edward. Copy the encrypted password string and use that to replace edward’s old password. For example, you know the password for the user leon, so you can use it as a temporary password for edward. The encrypted password is the string of characters after the user name, between the two colons ( :).įind another user whose password you know. Look for the user whose password you want to change. Use this command to open the file using the Nano text editor: nano /etc/shadow To solve this problem, you can copy another user’s encrypted password within the /etc/shadow file. When you enter the sudo passwd edward command on the terminal, you’ll have to enter the user password for edward. However, the command may require the user’s forgotten password if the system uses the LDAP authentication.įor example, you want to change the old password of a regular user named edward. Plus, they will have to enter their passwords to proceed with the command. Remember that non-root sudo users will have to use the sudo passwd command instead. The easiest way to do that is to log in as a root or sudo user, as you can use the passwd command to change the user password easily. In some cases, you need to reset the password of a regular user who forgot their password. ![]() Passwd: password updated successfully How to Change Linux User Password Without the Old One Once you have updated the other user password by using the passwd command, the following output will appear:.Next, the terminal will prompt the same request to enter the new password in the command line twice.Log in as the root user and use the passwd command followed by the user’s name.įor example, if you want to change the password of a user named edward, the command will look like this: passwd edward.The bash passwd command can also change the password of another user account in the system. How to Change Passwords for Other Users in Linux It of course assumes the sudo configuration allows you to run su with escalated privileges.Īlso, systems that come pre-configured with sudo access typically have the root account disabled (no root password), you can enable that using the passwd command after becoming root via sudo su.Important! If you’re logged in as a root user and don’t specify a user account, you’ll be changing the root password. This would roughly amount to replacing your friend's credit card credentials with your own using the legal proxy they gave you :). In other words, trying to su to someone you're not is like attempting to charge your purchases to a stolen credit card while using sudo is like selling your friend's car by legal proxy.Īs for what you were trying to do, just sudo su root, or even more simply sudo su and type your regular user password. This is why sudo needs to verify your own identity rather than that of the target user. Your own identity is used to determine what types of commands sudo will run for you under someone else's identity: if you're a trusted user (in the sense that the sysadmin trusts you), you'll be allowed more free rein than, say, an intern. Using sudo allows you to run certain (or all, depending on the configuration) commands as someone else. For this reason, when you type su, the system needs to verify that you have the credentials for the target user you're trying to change into. Su allows you to switch your identity with that of someone else. Contrary to what their most common use would lead you to think, su and sudo are not just meant for logging in (or performing actions) as root. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |