OnCallReadyStart learning

Filesystem, Permissions, Disk: glossary

81 terms, in plain words, with where each one is taught.

-exec
The find action that runs a command on the matches: {} \; once per file, {} + with many files at once. Lesson 4.15
-mtime
The find test for age by modification time, in whole days: -mtime +7 is "modified 8 or more full days ago". Lesson 4.15
-xdev (-x, --one-file-system)
Tells find (and du -x) to stay on the filesystem where it started and not walk into other mounts. Lesson 4.15
/dev/mapper
Where the kernel puts device files for LVM volumes, named VG-LV with any dashes inside the names doubled: /dev/mapper/ubuntu--vg-ubuntu--lv. Lesson 4.18
/etc
The directory for configuration: text files humans write and edit. The part of a server you keep in git. Lesson 4.1
/etc/group
The list of groups: name, GID and the members of each. Lesson 4.3
/etc/passwd
The list of user accounts: name, UID, primary group, home directory and login shell, one line each. Readable by everyone. Lesson 4.3
/etc/shadow
The file holding password hashes. Readable only by root and group shadow, so nobody can copy the hashes. Lesson 4.3
/opt
Home for self-contained third-party applications, each in its own directory, like /opt/app. Lesson 4.1
/run
Runtime state for the current boot: PID files and sockets. It lives in RAM, so it is empty after every reboot. Lesson 4.1
/srv
Data this machine serves to others, such as web files or shared folders. Lesson 4.1
/usr/local
Where software and scripts you install yourself go, outside the package manager. /usr/local/bin is on PATH and survives upgrades. Lesson 4.1
/var/lib
Where programs keep their state - data they write for themselves and need next time, like databases and package lists. Needs real backups; never delete casually. Lesson 4.1
/var/log
The directory for log files. Old logs are rotated (renamed, compressed, then deleted) by logrotate. Lesson 4.1
ACL (ACLs, access control list)
Extra per-user or per-group permission rules on a file, on top of the nine bits. getfacl shows them; ls -l marks them with a + after the mode.
apparent size
A file's length in bytes, what ls -l shows. du shows blocks actually used instead, which can be larger (tiny files) or smaller (sparse files). Lesson 4.19
Argument list too long (ARG_MAX)
The error when a glob expands to more filenames than the kernel accepts for one command. find with -delete or -exec ... + avoids it. Lesson 4.19
Avail
The df column for what an ordinary user can still write. It leaves out the root-only reserve, so Used + Avail is less than Size. Lesson 4.18
bind mount
Making an existing directory appear at a second place too (mount --bind). Used to look underneath a mount point. Lesson 4.18
character device
A device file that is a stream of bytes, like a terminal or /dev/null. Shown with a leading c in ls -l. Lesson 4.1
chown (chgrp)
"Change owner": sets a file's owner and/or group (chown root:ops f). chgrp sets only the group. Only root can give a file away. Lesson 4.5
copytruncate
A logrotate option: copy the log, then empty the original in place, so a program holding the file open keeps writing to a valid file. Lesson 4.21
The error when you try to hard-link across two filesystems. Inode numbers only mean something inside one filesystem. Lesson 4.13
A symlink whose target no longer exists. ls still lists it; opening it fails with "No such file or directory". Lesson 4.13
data block (blocks)
A fixed-size chunk of disk, usually 4 KiB, holding part of a file's contents. Lesson 4.13
deleted-but-open file (deleted but open, (deleted))
A file whose last name was removed while a process still has it open. It keeps its space until that process closes it; lsof +L1 finds it. Lesson 4.13
directory service (LDAP, Active Directory)
A central server that holds user accounts for many machines, so users need not be listed in each /etc/passwd. LDAP and Active Directory are common ones. Lesson 4.3
du
"Disk usage": walks a directory tree and adds up the space its files use. Sees only files that still have a name and that you can read. sudo du -xh / --max-depth=2 | sort -h | tail - see 4.19.
EACCES (Permission denied)
The error for a missing permission bit: the triple that applies to you does not allow it. Lesson 4.5
ENOSPC (No space left on device)
The "No space left on device" error: out of blocks, out of inodes, or an ordinary user hitting the root reserve. Lesson 4.21
EPERM (Operation not permitted)
The error for "you are not allowed to do this operation at all", e.g. chmod on a file you do not own. Different from a missing permission bit. Lesson 4.5
errno (error code)
The numbered error code the kernel returns when an operation fails, like ENOSPC or EACCES. The message you see is its translation. Lesson 4.21
FHS (Filesystem Hierarchy Standard)
The agreed list of top-level directories on Linux and what belongs in each: config in /etc, logs in /var/log, program state in /var/lib, and so on. Lesson 4.1
find
Walks every entry under a start directory, tests each one against an expression (type, name, size, age, mode, owner) and prints or acts on the matches. Lesson 4.9
findmnt
Shows what is mounted where, with the device, type and options. findmnt -T PATH says which filesystem a path lives on. Lesson 4.18
fragmentation
Files split into many scattered pieces on disk because there was no free stretch big enough. Slows reads down. Lesson 4.21
getent
Looks a user or group up the same way every program does - local files plus any central directory service - instead of reading one file. Lesson 4.3
GID (group ID, GIDs)
The number that identifies a group to the kernel, the way a UID identifies a user. Lesson 4.3
heap dump
A file holding a copy of a program's entire memory, written for debugging. Big, and full of whatever the program held - including secrets.
inode exhaustion (out of inodes)
A filesystem has used all its inodes, so no new file can be created even though blocks are free. df -i shows IUse% 100%. Lesson 4.21
locked account (locked)
An account whose password field starts with ! in /etc/shadow, so no password can ever match. Still usable through sudo -u or a service. Lesson 4.3
login shell
The program started when a user logs in, set in the last field of /etc/passwd. Normally bash; nologin for service accounts. Lesson 4.3
lost+found
A directory every ext4 filesystem has at its top, where the repair tool puts pieces of damaged files. Lesson 4.19
major/minor number (major, minor)
The two numbers a device file shows instead of a size: which driver handles it (major) and which instance (minor). Lesson 4.1
merged /usr
The Ubuntu layout where /bin, /sbin and /lib are symlinks into /usr, so each program has one real location. Lesson 4.1
mkfs (mkfs.ext4)
"Make filesystem": formats a partition, creating a new empty filesystem. Wipes what was there. Lesson 4.21
mode (file mode)
A file's permission bits (plus the special bits), shown as -rw-r--r-- by ls -l or 644 in octal. Lesson 4.5
namei (namei -l)
Walks a path and shows the mode and owner of every directory on the way, so you can see which level refuses access. Lesson 4.7
newgrp
Starts a sub-shell whose groups are re-read, so a group you were just added to takes effect without logging out. Lesson 4.3
nobody
User 65534, meaning "no user at all". Used for sandboxes and for unknown users on network file shares. Lesson 4.3
nologin (/usr/sbin/nologin)
A login shell that just prints "This account is currently not available" and exits, so the account cannot be logged in to. Lesson 4.3
nosuid
A mount option that makes the kernel ignore setuid and setgid bits on that filesystem. Lesson 4.9
orphaned files (-nouser)
Files whose owner UID no longer has a name, left behind by a deleted user. The next user given that UID silently owns them. Lesson 4.3
other
In permissions: every user who is neither the file's owner nor in its group. Lesson 4.5
password hash (hash, hashes)
A one-way scramble of a password: the system can check a typed password against it, but cannot turn it back into the password. Lesson 4.3
primary group
The one group in a user's /etc/passwd line. New files the user creates get this group (with one exception, setgid directories in 4.9). Lesson 4.3
privilege escalation
An ordinary user gaining more rights than they were given - for example becoming root through a bug in a setuid program. Lesson 4.9
quota (quotas, EDQUOT)
A limit on how much disk one user or group may use. Hitting it gives "Disk quota exceeded", whatever df says. Lesson 4.21
read-only remount (EROFS, Read-only file system, remount-ro)
ext4 switching itself to read-only after a disk error, to protect the data. Writes then fail with "Read-only file system". Lesson 4.21
Prints where a symlink points; with -f, the final full path after following every link. Lesson 4.13
reserved blocks (root reserve, reserve)
The share of an ext4 filesystem (5% by default) only root may use, so root can still work when users have filled the disk. Lesson 4.21
service account (system account, service accounts)
A user that exists only so a program can run as it (appuser, www-data). Nobody logs in as it: its shell is nologin and its password is locked. Lesson 4.3
setgid (setgid bit, sgid)
A special bit (2000). On a directory, new files inside get the directory's group instead of the creator's. On a program, it runs as the file's group. Lesson 4.9
setuid (setuid bit, suid)
A special bit (4000) on a program: it runs as the file's owner instead of as you. How sudo and passwd get root powers. Lesson 4.9
sparse file
A file with holes that were never written, like a VM disk image: its apparent size is large but it uses little disk. Lesson 4.19
state (service state)
Data a program writes for itself and needs the next time it starts, as opposed to configuration, which a human writes. Lesson 4.1
sticky bit (sticky)
A special bit (1000) on a directory: only a file's owner (or the directory's owner, or root) may delete or rename it. Why /tmp is 1777. Lesson 4.9
su
"Switch user": starts another user's login shell. Refused for accounts whose shell is nologin. Lesson 4.3
sudoers (/etc/sudoers)
The rules file that says who may run what with sudo. On Ubuntu, members of group sudo may run anything. Lesson 4.3
supplementary group (supplementary groups)
Any extra group a user is a member of in /etc/group. The kernel checks these too when a file's group permissions might apply. Lesson 4.3
symbolic mode
A chmod change written as who (u, g, o, a), then +, - or =, then bits: g+r, o-w, a=r. Relative, unlike octal. Lesson 4.5
traverse (search permission)
Using a directory as part of a path to reach something inside it. It needs the x bit on the directory. Lesson 4.7
triple (user/group/other)
One set of three permission bits (rwx): one triple for the owner, one for the group, one for other. The kernel checks exactly one of them. Lesson 4.5
truncate
Sets a file's size, usually to 0 (truncate -s 0 FILE), emptying it in place without deleting it. Lesson 4.21
tune2fs
Reads (-l) and changes settings of an ext4 filesystem, such as the reserved-block percentage (-m). Lesson 4.18
umask
A per-process mask of permission bits removed from every new file and directory. umask 022 turns a requested 666 into 644; an Ubuntu login's 0002 (user private groups) gives 664. Lesson 4.9
umount
The command that detaches a mounted filesystem from its directory. Lesson 4.18
user private group
The group with the same name as a user that useradd creates by default, used as that user's primary group. Lesson 4.3
usermod -aG (usermod)
Adds a user to a group, keeping the groups they already have. Without -a, -G replaces the whole list - including sudo. Lesson 4.3
world-writable (world-readable)
Writable (or readable) by other, i.e. by every user on the box. World-writable code or config is a security finding. Lesson 4.5
XFS
Another Linux filesystem type. Unlike ext4 it creates inodes as needed, so it does not run out of them early. Lesson 4.21