ITNuvoAkademiya
Academy homePackagesPlaylistsToolsSubnet calculatorSearchGlossary
CiscoCCNA · CCNA: networking fundamentals1. Introduction2. Network Fundamentals3. Network Access4. IP Connectivity5. IP Services6. IPv67. Security Fundamentals8. AutomationCCNP: Enterprise networks · coming soon
LinuxLinux: system administrator üçün · Linux for system administrators1. Getting to know Linux2. Working with text3. Users and permissions4. Processes and packages5. Inside the system6. Monitoring and logs7. NetworkingRed Hat Enterprise Linux · Red Hat Enterprise Linux: from beginner to advanced1. Getting started2. Packages3. Users and permissions4. SELinux5. Services6. Storage7. Networking8. Building services9. Boot and recovery10. DevOps11. Security and monitoring
FortinetFortiGate Administrator · FortiGate Administrator: from first login to ZTNA1. Getting to know FortiGate2. Routing, policy and NAT3. Security profiles4. Users and logs5. Resilience, SD-WAN and automation6. VDOM7. VPN and ZTNA8. Proxy9. DMZ
MonitoringZabbix · Zabbix: from installation to alerts1. Introduction2. Installation and the database3. Basics: groups, templates, users4. Connecting devices5. Alerts, Grafana and the API
VirtualizationProxmox VE · coming soonVMware ESXi · coming soon
My account / Sign in
AZENRU
← itnuvo.com

Users and groups: /etc/passwd, /etc/group, id

Lesson 3.17 minBeginnerDecember 1, 2026
Open

This lesson is open to everyone. The other lessons open with a package: sign in or sign up, then choose a package.

Key points

  • The system knows a user not by name but by UID (a number); root's UID is 0.
  • /etc/passwd holds users, /etc/shadow the password hashes (only root can read it), /etc/group the groups.
  • On Ubuntu regular users start at UID 1000; those below are service accounts (www-data, sshd).
  • Every user has one primary group and can have several supplementary groups.
  • id, whoami, groups, who answer "who am I and who is on the server?".

Why users are needed

A server runs several admins, a web server and a database. When each runs as a separate user, one cannot touch the files of another. For example, nginx runs as www-data: even if the site is hacked, the attacker does not become root and can only reach what www-data is allowed to.

Who am I?

srv-web01
ali@srv-web01:~$ whoami
ali
ali@srv-web01:~$ id
uid=1000(ali) gid=1000(ali) groups=1000(ali),4(adm),27(sudo)

id shows three things:

PartMeaning
uid=1000(ali)The user's number and name
gid=1000(ali)The primary group — files you create belong to it
groups=...All groups; sudo gives admin rights, adm lets you read logs

/etc/passwd

Each line is one user, with fields separated by ::

srv-web01
ali@srv-web01:~$ grep -E "^(root|www-data|ali):" /etc/passwd
root:x:0:0:root:/root:/bin/bash
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
ali:x:1000:1000:Ali,,,:/home/ali:/bin/bash
FieldExampleMeaning
1aliName
2xThe password is in /etc/shadow
31000UID
41000GID of the primary group
5Ali,,,Comment (full name)
6/home/aliHome directory
7/bin/bashLogin shell

An account whose shell is /usr/sbin/nologin cannot log in to a terminal — service accounts are like this.

UID ranges (Ubuntu)

UIDWho
0root — allowed everything
1–999System and service accounts
1000 and aboveRegular users
65534nobody — an account with no rights

/etc/shadow and /etc/group

Password hashes are in /etc/shadow, and only root can read it:

srv-web01
ali@srv-web01:~$ cat /etc/shadow
cat: /etc/shadow: Permission denied
ali@srv-web01:~$ grep -E "^(sudo|adm|www-data):" /etc/group
adm:x:4:syslog,ali
sudo:x:27:ali
www-data:x:33:

In /etc/group the last field lists the group's supplementary members. Only ali is in the sudo group, so only they can run admin commands.

Who is on the server?

srv-web01
ali@srv-web01:~$ who
ali      pts/0        2026-12-01 09:14 (10.20.0.5)
ali@srv-web01:~$ last -n 3
ali      pts/0        10.20.0.5        Tue Dec  1 09:14   still logged in
ali      pts/0        10.20.0.5        Mon Nov 30 17:02 - 18:40  (01:38)
reboot   system boot  6.8.0-49-generic Mon Nov 30 08:55   still running

who shows who is connected now and last shows recent logins. A login from an IP you do not recognise is a security signal.

Try id, groups and cat /etc/passwd in the Linux simulator.

Check yourself

5 questions · answers are shown instantly · 3 correct answers complete the lesson

1What does the system actually use to identify a user?

The name is just a label for the UID; permissions are checked by UID.

2What is root's UID?

An account with UID 0 is allowed everything.

3Where are password hashes stored?

/etc/passwd only contains x; the hashes are in /etc/shadow, which only root can read.

4What does the /usr/sbin/nologin shell mean?

Service accounts (for example www-data) are like this.

5Which command shows the UID, primary group and all groups together?

whoami shows only the name, who the connected users, last recent logins.
Was this lesson useful?

Comments

Sign in to comment.