DEV Community

Dan Higgins
Dan Higgins

Posted on

Day 5 of #30DaysRHCSAChallenge — The Sticky Bit Strikes Back

Welcome to Day 5, where we enter the secret lair of Linux file permissions and uncover magical artifacts like SUID, SGID, and the legendary Sticky Bit.

By the end of today, I half expected my Linux box to start chanting spells.

📚 Table of Contents

Today’s Lab of Doom

I created shared directories. I tested who could delete what. I accidentally gave a file SUID powers and it felt like I’d handed a toddler the root password.

Challenge Breakdown

  • Create a shared folder for a group
    • Add the SGID bit so group inheritance works
    • Set the Sticky Bit so users stop deleting each other’s stuff
    • Play with SUID on files (but not for evil)
    • Review file permissions like a digital detective

Spellbook of the Day

Image description

  1. mkdir /sysops_team - We're making a shared workspace — like a digital whiteboard everyone can write on.

  2. chown :devops_team /sysops_team - Assigns the group ownership to devops_team, so all group members have access.

  3. chmod 2775 /shared_team - This ensures any file created inside /sysops_team will automatically belong to devops_team, keeping things tidy and collaborative.

  4. chmod +t /sysops_team - Prevents team sabotage! Only the person who created a file (or root) can delete it, even though everyone can write in the directory.

  5. chmod u+s /usr/bin/passwd - This lets regular users change their passwords because passwd runs with root’s power, even though they’re not root. Use with caution!

  6. ls -l /shared_team - The inspection tool! This reveals whether your SGID and Sticky Bit are set correctly, and lets you marvel at your sysadmin wizardry (or lack of in this case!)

What I Learned (aka Lessons from the School of Bashcraft)

  • SGID = “Group loyalty forever!” Files created in that folder will inherit the group.

  • Sticky Bit = “You can’t delete my files, Karen.” Only the file owner (or root) can delete.

  • SUID = “Run me as the file’s owner.” Mostly used on programs like passwd. Don't mess this up unless you're aiming for hacker-of-the-month.

  • Watching ls -l change after each permission tweak is like checking the weather during a storm.

RHCSA Objectives Crushed Today

  • Manage special permissions like SUID, SGID, and Sticky Bit

  • Understand secure collaboration through group permissions

  • Level up in terminal-based trust issues

TL;DR

Today I learned that Linux file systems have more trust issues than my last team project in university. But at least chmod doesn’t ghost you.

Coming Tomorrow — Day 6

Mountains, Devices & Eternal Confusion
(AKA: "Why does my USB drive disappear when I sneeze?")

Top comments (0)

OSZAR »