Skip to main content

Table Of Contents

  • Linux OS Details
    • File System Structure
    • Important File/Directory Descriptions
    • /etc/shadow File Format
    • /etc/shadow Hash Types
    • /etc/passwd File Format

LINUX OS DETAILS

FILE SYSTEM STRUCTURE

PATHDESCRIPTION
/Anchor and root of the filesystem
/binUser binaries
/bootBoot-up related files
/devInterface for system devices
/etcSystem configuration files
/homeBase directory for user files
/libCritical software libraries
/optThird party software
/procSystem and running programs
/rootHome directory of root user
/sbinSystem administrator binaries
/tmpTemporary files
/usrContains all the system files. Less critical files
/varVariable system files

IMPORTANT FILE/DIRECTORY DESCRIPTIONS

FILE/DIRECTORYDESCRIPTION
/etc/shadowUser account information and password hashes
/etc/passwdUser account information
/etc/groupGroup names
/etc/rc.dStartup services (rc0.d-rc6.d)
/etc/init.dContains startup/stop scripts
/etc/hostsHardcoded hostname and IP combinations
/etc/hostnameFull hostname with domain
/etc/network/interfaces or /etc/netplannetwork configuration
/etc/profileSystem environment variables
/etc/apt/sources.listDebian package source
/etc/resolv.confDNS configuration
/home/<USER>/.bash_historyUser Bash history
/usr/share/wireshark/manufVendor-MAC lookup (Kali Linux)
~/.ssh/SSH keystore
/var/logSystem log files (most Linux)
/var/admSystem log files (Unix)
/var/spool/cronList cron files
/var/log/apache2/access.logApache connection log
/etc/fstabContains local and network configured mounts and shares

/ETC/SHADOW FILE FORMAT

  • Note: 1-9 Fields separated by ":"
    • Field-1: Login name -- Example: "root:"
    • Field-2: Encrypted password -- Example: "$6$RqNi$...PbED0:"
    • Field-3: Date of last password change (days since epoch) -- Example: "16520:"
    • Field-4: Minimum password age (in days) -- Example: "0:"
    • Field-5: Maximum password age (in days) -- Example: "99999:"
    • Field-6: Password warning period (in days) -- Example: "7:"
    • Field-7: Password inactivity period (in days) -- Example: ":"
    • Field-8: Account expiration date (days since epoch) -- Example: ":"
    • Field-9: Reserved -- Example: "" (empty)
123456789
root:$6$RqNi$...PbED0:16520:0:99999:7:::

/ETC/SHADOW HASH TYPES

  • Note: */etc/login.defs contains the shadow configuration.
  • Note: First three characters of the hash list the hash type
  • Example kryptonite:$6$n4wLdmr59pt.......:18912:0:99999:7:::
FIRST 3 CHARS OF THE HASH LISTHASH TYPE
$1$MD5
$2a$bcrypt
$2y$bcrypt
$5$SHA-256
$6$SHA-512

/ETC/PASSWD FILE FORMAT

  • Note: 7 Fields separated by ":"
    • Field-1: Login name -- Example: "root:"
    • Field-2: Password (x: password in shadow file, *: user cannot use login) -- Example: "x:"
    • Field-3: User ID (UID) root = 0 -- Example: "0:"
    • Field-4: Primary Group ID (GID) -- Example: "0:"
    • Field-5: Comment Field/User full name -- Example: "Root:"
    • Field-6: User’s home directory -- Example: "/root:"
    • Field-7: User’s default shell -- Example: "/bin/bash:"
1234567
root:x:0:0:Root:/root:/bin/bash: