How do I change all user passwords on my Linode?
I need to change all of my user's passwords but unsure which users exist on my system. How can I figure out what users I will need to change passwords for and how do I actually change them?
1 Reply
You can simply see all users in your system by checking the /etc/passwd
file and/or typing the following command into your terminal (or Lish window after logging in):
less /etc/passwd
This will output a long list of system and normal users. System users are typically created when installing the OS and new packages while normal users are users created by the root or another sudo user.
You'll likely only want to see a list of normal users. Before we can do so, we will need to gather another piece of information.
Anytime a user is created, they are assigned a UID. We can specify a command to show only normal users based on their UID but we will first need to verify your systems UID_MIN
and UID_MAX
. To do so, use the following command:
grep -E '^UID_MIN|^UID_MAX' /etc/login.defs
This should output something like this:
UID_MIN 1000
UID_MAX 60000
Now that we have those values, we can use them in our next command to list all normal users (with a UID):
getent passwd {1000..60000} | awk -F: '{ print $1}'
The values 1000 and 60000 in the command above should be adjusted based on the output to the previous command.
The output from that command will be a list of all normal users.
Now that you have a list of your normal users you can move forward in resetting the passwords for each user. You'll need to do so either logged in as root or a user with sudo privileges.
The following community post covers this in more detail:
https://www.linode.com/community/questions/17741/reset-user-password