0

I have an Ubuntu 12.04 server on which I've locked my only account, logged out, and now I cannot log in .

 jiechao@ubuntu-Jiechao:~$ sudo passwd -l jiechao
 passwd: password expiry information changed.
 jiechao@ubuntu-Jiechao:~$ logout
 Connection to 192.168.1.76 closed.

Now I cannot log in, as this is the only account on the server. How do I restore login access to this server?

2
  • 1
    How can you access the server ? If you have physical access boot it from a CD, mount read/write the root partition and them remove the !! for jiechao from the /etc/shadow file.
    – golja
    Sep 23, 2012 at 23:57
  • Hi, golja, thanks so much for the reply. I can boot it from CD, but how to change the /etc/shadow file? I don't know how to do that? Thanks
    – Jiechao Li
    Sep 24, 2012 at 0:01

2 Answers 2

3

Process to reset the password is in the Ubuntu Documentation: https://help.ubuntu.com/11.04/ubuntu-help/user-forgottenpassword.html

3
  • Thanks! RandomBit. My situation is the account is locked. I don't know whether it is the same with password reset. Actually, I did not changed the password.
    – Jiechao Li
    Sep 24, 2012 at 0:48
  • Root always exists. One hopes not disabled. Should be able to "sudo passwd" to make adjustments: help.ubuntu.com/11.04/serverguide/user-management.html (password expiration bits are further down the page)
    – RandomBit
    Sep 24, 2012 at 2:57
  • A password that was disabled by the 'passwd -l' syntax probably means that it has been prepended with a bang (!) character. You might simply be able to edit the /etc/shadow file and remove the leading '!' character. But at that point it's simply easier to do it properly and unlock the account with the passwd command.
    – Magellan
    Sep 24, 2012 at 3:41
2

"Physical" access is the only answer in situations where you have locked your only account.

Boot it up in single user mode. This will require 'rw' mode instead of 'ro' and specifying 'init=/bin/bash' while removing 'quiet' and 'splash'.

Note: Physical access and virtual environments such as VMware may mean a client console. Amazon instances may be much more difficult to impossible.

2
  • Hi, Adrian. Thanks for the answer I am using my own physical server. Not amazon service or VMware virtual machine. If I boot it up in single user mode, can I log in my locked account? or another account?
    – Jiechao Li
    Sep 24, 2012 at 0:13
  • If you're in single user mode, you can operate as if you were root. You can unlock accounts, fix filesystems, and many other tasks that require root.
    – Magellan
    Sep 24, 2012 at 0:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .