Unfortunately i forgot my username or password for my account, how do i know what is my username??

I can open the terminal at login screen, and then the terminal screen shows this

elementary OS Loki asfi-inspiron-3521 tty1
asfi-inspiron-3521 login:

3 Answers 3


You can just hold down right-shift while booting, and select the second line "elementary OS … (recovery mode)" from the menu. After the boot, you can select "Drop to a root shell prompt" from the menu. You can find your username with ls /home and you can change your password with passwd username.

  • It can't be that easy. (I hope) Commented Feb 7, 2017 at 5:45
  • 1
    It is unless you have changed default settings.
    – lemonslice
    Commented Feb 7, 2017 at 10:06
  • how can one use sudo without a password. Commented Feb 7, 2017 at 13:15

If you want to check your username when you are logged in you can just type whoami

If you need to get username at your local machine, you have all users listed in /etc/passwd.

You should have your account listed on greeting screen, if you didn't hide it after install.

However if you don't know your username nor password I think that there is no way to log into your account - if it would be so easy then it would make no sense creating accounts - even in windows they repair backdoors caused by recovery mode and cmd mode.

  • when i get to login screen and then click on my account, nothing happens, the click is not working.. and for guest session, the click works but not working on personal account Commented Feb 7, 2017 at 9:51
  • Then I recommend checking username in /etc/passwd :)
    – Dysproz
    Commented Feb 7, 2017 at 10:45
  • im new to elementary and terminal, how will i check? when i open terminal it is asking me for login elementary OS Loki asfi-inspiron-3521 tty1 asfi-inspiron-3521 login: Commented Feb 7, 2017 at 10:51
  • and when i open guest session, nothing is there, i won't let me do anything there... i cannot see anything except the desktop Commented Feb 7, 2017 at 10:52
  • you should boot in recovery mode
    – lemonslice
    Commented Feb 7, 2017 at 18:05

Try running this command to get the users in the system:

awk -F'[/:]' '{if ($3 >= 1000 && $3 != 65534) print $1}' /etc/passwd

There are more answers here: https://askubuntu.com/questions/410244/a-command-to-list-all-users-and-how-to-add-delete-modify-users

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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