3

When I boot system with ubuntu all I see is my background (No DASH, can't open terminal, etc). I've googled for this issue and the only solution seems to be getting to the command line with ctrl+alt+f1 and writting some commands. But when you get to this command line you must write your username and password in order to do anything else. My problem is that I don't remember my username. Is there a solution?

4
  • Don't have it, somebody lent it to me.
    – James 100
    Jun 24, 2015 at 10:18
  • @Tim I could make one but just in case there is no other solution. Mmmm.. you mean like a hard drive manager tool or something? I have Windows installed in the same hard drive, let me search for one.
    – James 100
    Jun 24, 2015 at 10:25
  • Ah, sorry, only reading the question's title has its disadvantages ;( Jun 24, 2015 at 10:27
  • @Tim ok let me try
    – James 100
    Jun 24, 2015 at 10:30

2 Answers 2

8

Boot into recovery mode. Hold Left Shift while your computer boots until the GRUB menu shows up. Pick the first "Advanced" option and then pick recovery mode. When it asks, pick the root console.

Now you're root. You can list users in a number of ways:

awk -F: '$3>999 {print $1}' /etc/passwd
cut -d : -f 1 /etc/passwd
cat /etc/passwd
ls /home/

At least one of those should give you your username.

You can then reboot (with the reboot command) and hopefully log in. If that doesn't work, you can come back and reset your password too, or create a new user.


If you want to do other things (like adding users), you'll need to remount your disk with write access:

mount -o remount,rw /
2
  • The first one is the best, the second doesn't have my user, the third has a lot of other stuffs in there and the last works well. However, the first gives a user called nobody, and i'm not sure why.
    – Tim
    Jun 24, 2015 at 10:34
  • 1
    I've written a longer version before but it gets a bit silly: awk -F: '$3 >= 1000 && $1 != "nobody" {print $1}' /etc/passwd
    – Oli
    Jun 24, 2015 at 10:36
0

Switch on your computer.

Press and hold the Shift key, which will bring up the Grub menu.

Select the line which starts with Advanced options.

Select the line ending with recovery mode.

Your computer should display a menu with a number of options.

One of the options will be Drop to root shell prompt, select it

In the terminal, enter the following commands:

mount -o remount, rw /
mount --all
ls /home

The output of this command displays the directory name that corresponds to your username.

If you forget your password, using the following command you can change:

passwd [user_name]

You must enter it twice and the display will show nothing, for security reasons.

You must log in to answer this question.

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