Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How do I reset a lost administrative password?

For some reasons i have deleted my user with his /home/. And now i have guest account and root, for which i can't set password.

And i need to add a new user. Any ideas ?

I am using Ubuntu 12.10

share|improve this question

marked as duplicate by psusi, Jorge Castro, Eliah Kagan, fossfreedom Dec 19 '12 at 9:26

This question was marked as an exact duplicate of an existing question.

From the ubuntu CD, open terminal, and mount the root partition:

$ sudo mount /dev/sda1 /mnt # Example, change /dev/sda1 to your root partition

Then, use chroot:

$ sudo chroot /mnt

Voila, you have root access. Now you need to use adduser:

$ sudo useradd username
share|improve this answer
The third command doesn't need sudo, as you'd have sudo permissions already. – papukaija Jul 8 '13 at 22:51

You can add a new user or change the existing password in 2 ways:

  1. Boot the computer using a live CD, mount the ubuntu partition and then chroot to it and then do useradd username to add a new user, or change the password of existing users using passwd username command eg passwd root to change the root password

  2. Another method(if you dont have a live CD) would be to hack the system through the grub menu. while booting press shift to enter the grub menu and then press e to edit the ubuntu grub entry.Then edit the inintrd line or add rw S init=/bin/sh and then press b or ctrl + x.This would boot up and bring up a terminal with root privileges. You can then add a new user or change the password like mentioned above

You can read more about the grub hack over here or a simple google search would give you tons of results

share|improve this answer
You don't need sudo when you are already running as root in the chroot, and you don't need to muck about with the command line arguments to get a root shell; it's right there on the rescue menu. – psusi Dec 19 '12 at 3:36
yeah correct :) must have missed it out – Mevin Babu Dec 19 '12 at 3:37

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