Linux Permissions Cheat Sheet
Linux VPS ยท Beginner Reference

Permissions & Users

Everything you need to understand Linux users, directories & permissions

01 ยท Prompt

Reading the Shell Prompt

root @ srv1628184 : ~ #
  • root Current logged-in username โ€” the superuser/administrator
  • @ Separator meaning “at”
  • srv1628184 Hostname of your server
  • ~ Current directory โ€” tilde = home folder (/root for root user)
  • # You are root. Regular users see $ instead
02 ยท Directories

Key Directory Structure

/ โ† root of the entire filesystem
โ”œโ”€โ”€ root/ โ† root user’s home folder
โ”œโ”€โ”€ home/ โ† regular users live here
โ”‚ โ”œโ”€โ”€ john/ โ† john’s private folder
โ”‚ โ””โ”€โ”€ mary/ โ† mary’s private folder
โ”œโ”€โ”€ etc/ โ† system config files
โ””โ”€โ”€ var/ โ† logs, web files, etc.
  • /root Root’s private home โ€” nobody else can enter
  • /home/user Each user owns their own folder only
  • ~ Shortcut for your own home โ€” changes per user
03 ยท Permission String

How to Read Permissions

r
w
x
|
r
x
|
r
type
r
w
x
r
x
r
WhoPermissionsMeaning
Owner r w x Read, Write & Execute
Group r x Read & Execute only
Others r Read only
04 ยท Access Types

What r ยท w ยท x Mean

SymbolNameOn a FileOn a Folder
r Read Open & view it List files inside
w Write Edit or delete Create/delete files inside
x Execute Run as a program Enter with cd
Denied Permission not granted
๐Ÿ’ก A folder needs x to enter it with cd. Without it you get Permission denied even if you can see the folder.
05 ยท Access Matrix

Who Can Access What

Directoryrootownerother user
/ โœ“ read only read only
/root โœ“ โœ— โœ—
/home/john โœ“ โœ“ โœ—
/home/mary โœ“ โœ“ โœ—
/etc โœ“ read only read only
โš ๏ธ root overrides everything. Root can read, write and execute any file on the system regardless of what permissions are set.
06 ยท Commands

Essential Commands

$ ls -la list files with permissions
$ pwd show current directory path
$ whoami show current username
# adduser john create a new user
# usermod -aG sudo john give sudo privileges
# chmod 755 folder/ set folder permissions
# chown john file.txt change file owner
โœ… # prompt = root  ยท  $ prompt = regular user.
Use sudo command as a regular user to run something as root.
Linux Permissions Cheat Sheet  ยท  VPS Beginner Reference