I'm trying to add a new use to a linux machine. I used this command.
adduser "user_name" -u "UID" -G "GROUP_NAME"
the entry what is see in /etc/shadow is
"user_name":$1$IfBL9BXC$ealgUJum3HJsDRqOUY74O1:0:0:99999::::
But when I try to login with the same user name,my password was accepted but immediately asked me to change password as below.
You are required to change your password immediately (root enforced)
What should I do?
For anyone who comes across this when dealing with eg. DigitalOcean machines which are set up this way, and don't feel like manually fixing this because they automate deployments anyway and only use publickey authentication, here's an Ansible task to fix this:
# http://docs.ansible.com/ansible/lineinfile_module.html
# Get rid of DO's root password and 'you must change next time you login' stuff
- name: Setup root account properly
lineinfile:
backup: yes
dest: /etc/shadow
regexp: "^root:.*$"
state: present
line: "root:*:16231:0:99999:7:::"
The best thing to do is to change your password as asked.
The third field in the /etc/shadow file indicates the number of days (since January 1, 1970) since the password was last changed. An empty values indicates the password was never changed and a value of 0 forces the user to change it.
As an alternative, you can edit your /etc/shadow file and remove the 0 from the third field. But do that at your own risk.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With