Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
1  
that last command disabled root –  Mateo Mar 26 at 1:38

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
Thanks! The problem is that I don't know how to access the shell prompt again. I am currently stuck on the tty1 login prompt that I access either with their html console (bit.ly/1dqtgtz) or via ssh. –  SpidrJeru Mar 26 at 11:38
    
it appears I was connecting to my server this way ssh mydomain.com@my.server.ip instead of ssh root@my.server.ip. The later allows me directly in shell prompt (if ssh keys are properly set up). –  SpidrJeru Mar 26 at 12:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.