This is a very useful method to employ if you forget your password and need access to the operating system

Oct 3, 2014 07:28 GMT  ·  By

Getting past the Ubuntu login screen without the password is quite easy, and this method can really come in handy when you forget the keyword, for example.

Like a lot of other Linux procedures, this method can also be used for some nefarious purposes and no one can really stop people from doing it. The truth of the matter is that, on most Linux systems, if no special measures are taken, the login screen is only a formality and someone determined to enter will be able to do it without any trouble.

We used Ubuntu as an example because it's the most widely available Linux distribution, but it works on other operating systems as well. Don't think that if you have a password no one will be able to access your system. They will have a hard time doing it remotely, but it's a different discussion altogether when the user sits in front of the PC.

This is also a good method to gain access to a system that you have but you can't remember the password to. This happens more often than you think, so having a solution to fix this problem is not all that bad.

Changing the password for Ubuntu users

So, you've reached the login screen and you can't log in. The first thing you do is to hit the restart button. If you have a single operating system on your PC you won't see the GRUB boot loader and that is very important. You will need to hold down the Shift button during the boot process and this will force the system to stop at the boot loader.

From there, you have to access the "Advanced options for Ubuntu" and then choose the second entry, which says "recovery mode" right near the version of the kernel. You will see a lot of text scrolling up and eventually you will arrive in the Recovery Menu. Go down to the second to last option, which is called "root" or "Drop to root shell prompt." You are now root on your system.

The problem is that the system right now is in a read-only state and that needs to be changed. Enter the following command:

code
mount -n -o remount,rw /
If you write it correctly there will be no message. The filesystem is no longer read-only and you can change the password. The only condition is that you know the user name. Enter this command:
code
passwd username
Replace the word username in the above command with your own. You will be prompted to provide a new Unix password, twice. If you've done things correctly the terminal should say "password updated successfully." Now enter the command "reboot" and you can log in your account with the new password you just set.

How to protect yourself

By default, the GRUB boot loader is not protected by a password, but that can be remedied. The only way to ensure that someone doesn't access your account is to set up a GRUB password. The Ubuntu developers have a comprehensive wiki about this process. It's not the easiest, but at least you will be secure. Also, it's worth mentioning that you can only set the GRUB password if you are root.

Password has been changed
Password has been changed

Ubuntu tutorial (3 Images)

GRUB entry
Recovery mode in GRUBPassword has been changed
Open gallery