Linux Labs

Users, permissions, and processes / Stage 6 of 13

Accounts and their lifecycle

Not running Starting usually ~20 s
Leave the lesson

Step 3 of 7 · on a machine · 5 min

Create an account

useradd creates an account. What appears besides the line in /etc/passwd depends on the options: without them this machine gives you neither a home directory nor the usual shell.

bash
sudo useradd -m -U -s /bin/bash name

-m creates the home directory /home/name, -U creates a group with the same name, and -s sets the login shell. Without -s the shell becomes /bin/sh, and without -m there is no directory at all.

useradd sets no password. sudo passwd -S name prints the password state: a second field of P means there is a password, L means it is locked. A new account without a password shows L: password login is impossible until sudo passwd name sets one.

Exercise · do it

Create the intern's account

Create the labuser account: home directory /home/labuser, its own labuser group, and the /bin/bash login shell. Do not set a password.

Sign in and start The machine is available after signing in

Goals · 0 of 2

  • Create labuser with its own group and the /bin/bash shell not done yet
  • Create the home directory /home/labuser not done yet

Step goals

0 of 2
  • Create labuser with its own group and the /bin/bash shell — not done yet
  • Create the home directory /home/labuser — not done yet
Ubuntu 24.04

Step goals

0 of 2
  • Create labuser with its own group and the /bin/bash shell — not done yet
  • Create the home directory /home/labuser — not done yet
Loading…