- File Hierarchy Standard (FHS) - `/` - root directory for fs - owned by root user - `/bin` - essential binaries needed during boot and single-user mode - `ls`, `cat`, `cp`, `mv`, `rm`![[images/Pasted image 20250806171527.png]] - `/sbin` - binaries used by sysadmin that require root priv - `fdisk`, `fsck`, `init`, `reboot`, `shutdown` ![[images/Pasted image 20250806171604.png]] - `/etc` - config files for many services and apps - "control center" - system config files: - `passwd` (acct info) - `shadow` (password hashes) - `group` (group info) - `hosts` (ip address mappings) - `hostname` (system hostname) - network/interfaces (network interface config) - `resolv.conf` (DNS resolver config) - `sysctl.conf` (kernel params) - `nsswitch.conf` aka Name Service Switch![[images/Pasted image 20250806171742.png]] - `getent` retrieves entries from based on `/etc/nsswitch.conf` - `sudo getent passwd user_name` - service config files: - `/etc/ssh/sshd_config` - apache2 - nginx - `/etc/mysql/my.cnf` - `/etc/postgresql/postgresql.conf` - `/etc/ssh/ssh_config` config file for ssh client - `/etc/ssh/sshd_config` config file for ssh server - `/etc/rsyslog.d/50-default.conf` config file for syslog - shows how log data is split into different file locations - package mgr files: - `/etc/apt/sources.list` - `/etc/yum.repos.d` - `/home` - user accounts & files - key directories per user: - `Documents` - `Downloads` - `Music` - `Pictures` - `Public` (used to share files with other users) - `Videos` - each user's home directory is owned by that user and is only accessible to that user and root - `/var` - variable data - system logs, temp files that survive reboots, mail spools - key directories:` log`, `mail`, `spool`, `lib` (stores info for apps to maintain their state), `tmp` - `/var/log/boot.log` - `/var/log/auth.log` - `/var/log/syslog` - `/var/log/cron` - important considerations: regular cleanup of tmp, log rotation, permissions, backup - `/usr` - user programs and libraries - key directories: - `/usr/bin` (accessible to all users) ![[images/Pasted image 20250806172102.png]] - `/usr/sbin` (requires root privs) ![[images/Pasted image 20250806172122.png]] - `/usr/lib` ![[images/Pasted image 20250806172139.png]] - `/usr/local` (locally installed SW outside of package mgr) - `share` - `/usr/share/doc` (documentation for system utilities and installed SW) - `/usr/src` (source code for various system utilities) - important considerations: read-only, package mgmt, user access - `/opt` - optional SW - designed for optional SW installations from third-party sources - why use `/opt`: organization, isolation, flexibility - keeps optional SW separate from base system so it's easier to manage and remove - important considerations: ownership and permission, package mgmt, config, cleanup - `/dev` - virtual device interface - virtual fs that represents HW devices as files - allows OS to interact with HW devices using standard file operations - common directories: `hdX` for PATA drives, `sdX` for SATA drives, `nvmeXnY` for nvme drives (where X=drive # and Y=partition #), `mdX` for RAID arrays, `lpX` for printers, `cdrom`, `tty*` (teletypewriters devices such as USB, etc.), `null` (special files that discards data written to it - linux's "black hole"), `zero` (special file that produces infinite stream of null characters or 0x00, which are different from ASCII 0s) - can be character or block devices - see first letter of permissions set for c or b designator - important considerations: dynamic consideration, permissions, device drivers - `/tmp` - temp fs that's wiped on reboot - this directory has w and x perms --> popular target for hackers - important considerations: automatic cleanup (regular intervals and reboot), security, manual cleanup possible - other important directories - `/boot` - stores boot loader files - `/lib` - stores shared libraries used by programs - `/mnt` - tmp mount point for removable media - `/proc` - virtual fs providing info on system processes - `/srv` - stores data for certain services provided by system - `/sys` - virtual fs providing info about system's HW