There may be a time where you have a Linux system and you are not sure of the user account to be used. With a few steps, we can list the local user accounts on a system without first needing to login.
What you will need
For this guide, we’re going to assume you have the following in place:
- A working Debian-based device, such as Debian, Ubuntu, or Linux Mint. For this walkthrough we are using Linux Mint 20 on a VirtualBox virtual machine.
Steps to List Local Users Without Logging In
1. During the system/BIOS boot screen, press and hold your system’s boot up hotkey. This is usually the <shift> key, but could be another key, such as <esc> or a function key like <F2>. The goal is to stop the normal boot process from continuing, and instead be presented with the GRUB boot menu
2. Select (and press <Enter>) for the “Advanced Options” choice
3. Select and press <Enter> on the most recent (e.g. highest version) option listed that also shows “(recovery mode)”.
4. Highlight and press <Enter> on the option for “Drop to root shell prompt”
5. Press <Enter> to confirm and continue into our maintenance mode
6. At the command prompt, type in (and then press <Enter>):
cut -d: -f1 /etc/passwd | less
7. You will see the first page of users that are configured on your system. If you see the last line of the screen with a colon “:”, press <Space> to continue to the next page and view more users.
8. Continue pressing <Space> to cycle through the pages of users until you see the user account you are looking for, or you receive the highlighted “END” on the last line. Press “q” to exit the user listing. With the desired username found, you can now reboot and continue logging in as expected.