Skip to main content

Unit 5 · Passwords and Policy · Lesson 11 of 25

No Password, and the Root Account

Finding accounts that can be logged into without a password, and locking root.

Finding an account with no password

An account with no password is a door with no lock. Finding one is worth points, and it takes one file.

Open the password file

sudo nano /etc/shadow

One line per account. The part between the first and second colon is the password, stored scrambled:

yaga:$y$j9T$abc123...:19700:1:90:7:::
 │        │
 │        └── the scrambled password
 └─────────── the name

Now look at what can appear there:

Between the first two colonsWhat it means
A long jumble starting $y$ or $6$a real password. Fine
Nothing at all, two colons togetherno password. Press Enter and you are in
! or !!locked, cannot be logged into with a password. Usually fine
*a system account that was never meant to log in. Fine

You are hunting for the second row: a line that reads name:: with nothing in between. Leave with Ctrl+X.

💡 Empty and ! look similar and mean opposite things. ! is a lock. Empty is an open door.

Fixing it

Easiest way is the settings panel:

Settings  →  Users  →  Unlock  →  click the account  →  Password

Or in a terminal:

sudo passwd NAME

Locking the root account

Ubuntu normally ships with root locked, and the checker usually wants it that way. One command:

sudo passwd -l root

To check what it is now:

sudo passwd -S root

That prints L for locked, P for a usable password, or NP for none.

💡 A strong root password is not the same as a locked root account. The check is for the lock, so setting a long password instead scores nothing.

Try it yourself

sudo nano /etc/shadow    # find the line with nothing between the first two colons
sudo passwd -S root      # is root locked?

Capture-the-flag challenge

Put the lesson to work on a challenge and submit the flag you find. Create a free account to do this part.

Do this lesson for real

With a free account you get the terminal, the challenges and the checks that go with every lesson in CyberPatriot Linux: Tokyo Jujutsu High, and your progress is saved as you go. CyberAcad is a 501(c)(3) nonprofit, so there is nothing to pay.