Ubuntu – I deleted the original user account. The new account has no password. How to enable it?

password-recoverypermissionsusernameusers

Possible Duplicate:
How do I add myself back as a sudo user?

How can enable my admin account? i deleted the other one and now the new one is without password and i cant access it and cant do anything with my guest account.

Best Answer

This suggestion is based on a previous answer. It assumes you are using Ubuntu 12.04 LTS.

  1. Boot your computer to the GRUB boot menu. If necessary, press the shift key immediately after booting starts to force the GRUB menu to be displayed.
  2. Select an entry which will boot into recovery mode.
  3. The text graphics menu shown in the image below should appear. Use the up or down arrow key to select an entry.
    • Select root (Drop to root shell prompt) and press enter.

      recovery menu with <code>root</code> entry selected
  4. The system is currently mounted as read only. Enter the command below to remount your file system as read/write. This allows you to make changes.
    mount -o remount,rw /
  5. In your question you said you created a new username which does not have a password. Since I do not know what that new username is, I will use REPLACE-WITH-USERNAME to refer to it. Please replace REPLACE-WITH-USERNAME with your new username which is not working in the commands below.
  6. Choose and create a password for this username with the command below.
    passwd REPLACE-WITH-USERNAME
  7. Use the command below to list all the groups this username is currently a member of.
    groups REPLACE-WITH-USERNAME
  8. If step (7) shows that the username is a member of the nopasswdlogin group, use the command below to remove it from this group.
    gpasswd --delete REPLACE-WITH-USERNAME nopasswdlogin
  9. In the unlikely event that you do not see the username itself listed in the output from the groups command in step (7), use the command below to add it and make it the primary login group for this username.
    usermod -g REPLACE-WITH-USERNAME REPLACE-WITH-USERNAME

    Note: Yes, the username is repeated twice. For example, if the username were joeuser the command would be usermod -g joeuser joeuser
  10. Use the command below to ensure the username is in all the default groups it should be. Note: Do not add spaces between the commas (,)
    usermod -a -G adm,cdrom,sudo,dip,plugdev,lpadmin,sambashare REPLACE-WITH-USERNAME
  11. Repeat the groups command in step (7) to verify that the username was correctly added to the groups.
  12. Restart your system with the command below. (It can take a few seconds. Wait for it ...)
    reboot
  13. Login using the password you chose for the username in step (6).
    • I suggest also trying, for example, sudo fdisk -l to verify that sudo is working for you correctly.
    • I would also retry the groups command from step (7) to verify one last time that the username is a member of the groups it should be in. (Better safe than sorry, no?)
Related Question