Question
How can I recreate a user in my /etc/shadow file?
Answer
Restoring from a backup is the best solution; however, using the 'chage' command can create an entry for the user in /etc/shadow file.
Note: In the commands below, substitute $user for the username you wish to use.
- Access your server using SSH as the root user.
Verify that the user does not have a shadow entry by running the getent command against it. No output confirms the user is missing:
# getent shadow $user
If the user is confirmed missing, use chage to create the shadow file entry:
# chage -m 0 $user
- You can use getent as described in step 2 to confirm the entry was created successfully.
Comments
0 comments
Article is closed for comments.