Friday, August 4, 2017

Changed root password on my server, now can't login anymore


I decided to change the root password that came preset on a fresh DigitalOcean server (ubuntu 12.04).


I used the first answer to this post: How to change root password in ubuntu?


which is:


sudo -i
passwd

(set my new password on prompt)


sudo passwd -dl root

Now I can't login as root on tty1 on my server, nor can I access my server on Filezilla, etc...


What did I do wrong, and more importantly how can I recover my root login?


Thank you for your help.



The command


 sudo passwd -dl root

is for disabling root and removing root password. As explained in man passwd:



-d --delete


Delete a user's password (make it empty). This is a quick way to disable a password for an account. It will set the named account passwordless.


-l --lock


Lock the password of the named account. This option disables a
password by changing it to a value which matches no possible encrypted value (it adds a ´!´ at the beginning of the password).



So you just need to set root password again.


So, first execute in a terminal


sudo passwd root

or


sudo -i
passwd

you will be prompted for a new Unix password. Write it twice (second time for confirmation).


Then execute


sudo passwd -u root

to unlock the account. This should return


passwd: password expiry information changed

Now you will be able to access root. But it is not a good idea as you can see here.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...