Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Permissions & Users

Every file and program on a Linux system belongs to a user and a group, and every one of them has a set of permissions saying who can read, write, or execute it. Learning how permissions work — and how to switch identity safely with sudo and su — is the single most important safety skill on a Linux system. It is also where most “Permission denied” errors come from, and where mistakes can do real damage.

Why This Section Comes After Navigation and File Ops

By now you can move around the filesystem and look at files. This section adds the other half of the picture: who is allowed to do what. You will learn to read permission strings, change them, run commands as another user, and understand the accounts that make a Linux system tick.


The Model in One Picture

-rw-r--r--  1 alice  staff  4096 Dec  4 10:00 notes.txt
 ^^^^^^^^^^  ^^^^^  ^^^^^
 permissions owner  group

 -  rw-  r--
 │   │   └── others (everyone else)
 │   └────── group
 └────────── owner

The nine permission bits answer three questions: what can the owner do, what can the group do, and what can everyone else do? Read, write, and execute are the answers.


Common Permission & User Tools

ToolPurpose
chmodChange file permissions
chownChange file owner and/or group
chgrpChange a file’s group
umaskSet the default permissions for new files
sudoRun a single command as another user
suSwitch your shell to another user
idShow who you are and what groups you’re in
whoamiPrint your current username
passwdChange a user’s password
useraddCreate a new user account
/etc/passwdThe file that stores every account

Why This Matters

  • Understanding permissions explains most “Permission denied” errors — and how to fix them safely instead of blindly reaching for sudo.
  • sudo is how you do administration; knowing when to use it (and when not to) keeps your system safe.
  • Managing users and groups is a prerequisite for setting up servers, sharing files between people, and running services securely.
  • The concepts apply everywhere: Linux, macOS, servers, containers, and cloud instances all use the same permission model.

Start with chmod to understand how permissions are read and changed, then learn the identity commands (id, whoami) and how to switch users with sudo and su.

Rule of thumb: if a command needs sudo “just to work”, stop and understand why before running it. Most permission errors have a safer, narrower fix than “run everything as root”.