Mastering Linux File Systems: Key Directories, Commands, and Permissions

Listen to this Post

Featured Image

Introduction

Linux file systems form the backbone of operating system management, cybersecurity, and IT infrastructure. Understanding core directories, permissions, and commands is essential for system administration, ethical hacking, and vulnerability assessments. This guide explores critical Linux file system concepts, commands, and hardening techniques.

Learning Objectives

  • Navigate and manage Linux file systems efficiently.
  • Understand file permissions and ownership for security hardening.
  • Utilize essential commands for system administration and cybersecurity tasks.

1. Linux File System Hierarchy Explained

Key Directories

– `/` – Root directory (top-level).
– `/home` – User home directories (e.g., /home/username).
– `/etc` – System and application configuration files.
– `/var` – Logs, temporary files, and databases.
– `/bin` & `/sbin` – Essential system binaries (e.g., ls, cp).
– `/usr` – User-installed software and libraries.
– `/tmp` – Temporary files (cleared on reboot).
– `/dev` – Device files (e.g., `/dev/sda` for disks).
– `/proc` – Virtual files for system/process info.

Command to List Directory Contents

ls -la /etc  Lists all files (including hidden) in /etc with details 

What It Does:

– `-l` shows detailed permissions.
– `-a` includes hidden files (e.g., .bashrc).

2. File System Types in Linux

Common File Systems

– `ext4` – Default for most Linux distributions.
– `btrfs` – Supports snapshots and compression.
– `xfs` – High performance for large files.
– `NTFS/FAT32` – Windows compatibility.

Check Disk Usage

df -h  Displays disk space in human-readable format 

What It Does:

  • Shows mounted partitions and available space.

3. Managing File Permissions for Security

View Permissions

ls -l file.txt  Output: -rwxr-xr-- 

– `rwx` (User) | `r-x` (Group) | `r–` (Others).

Modify Permissions

chmod 750 script.sh  Sets rwx for owner, r-x for group, no access for others 

Breakdown:

– `7` (4+2+1 = rwx)
– `5` (4+1 = r-x)
– `0` (No access).

Change Ownership

chown root:admin file.txt  Sets owner to root, group to admin 

4. Mounting and Unmounting Drives

Mount a USB Drive

sudo mount /dev/sdb1 /mnt/usb  Mounts USB to /mnt/usb 

Unmount Safely

sudo umount /mnt/usb  Detaches the USB 

5. Searching and Managing Files

Find Files by Name

find / -type f -name ".conf"  Searches all .conf files 

Check Directory Size

du -sh /var/log  Shows total size of /var/log 

What Undercode Say

  • Key Takeaway 1: Misconfigured permissions (chmod 777) expose systems to attacks. Always follow least privilege.
  • Key Takeaway 2: `/etc` contains critical configs—securing it prevents unauthorized changes.

Analysis:

Linux file system knowledge is crucial for cybersecurity professionals. Attackers often exploit weak permissions or misconfigured directories. Hardening involves:
– Restricting `/tmp` with `noexec` to prevent malicious script execution.
– Regularly auditing `/etc` for unauthorized changes.
– Using `find` to locate world-writable files (find / -perm -o=w).

Prediction

As Linux dominates cloud and IoT, attacks targeting file systems will rise. Automation tools (e.g., Ansible) will integrate real-time permission auditing, while AI-driven anomaly detection will flag suspicious file changes.

By mastering these commands and concepts, IT professionals can secure systems against evolving threats. 🚀

IT/Security Reporter URL:

Reported By: Priyank Gada – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

💬 Whatsapp | 💬 Telegram