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.

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.

share|improve this question

marked as duplicate by Alvar, fossfreedom Jun 9 '12 at 8:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

1 Answer 1

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?)
share|improve this answer
1  
The admin account isn't called sudo; it's called root. The sudo command allows commands to be executed with root privileges. It is impossible to know the root password - (Techy bit - the password hash stored in /etc/shadow begins with !, and there is no possible value which can be hashed to get that output) –  jackweirdy May 13 '12 at 20:56
add comment

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