Stop your users from littering home directories with junk
User & Group Management
Stop your users from littering home directories with junk
🧩 The Challenge
Dealing with a new hire or a consultant who dumps their entire workflow into /home/username is a nightmare for backups and general sanity. Nobody wants to clean up a graveyard of unzipped tarballs when they leave the project.
💡 The Fix
Change their shell to nologin or a restricted environment if they shouldn’t be there, or better yet, force their home directory to exist on a separate, quota-limited partition so they hit a wall before they trash the system disk. You can manage this at creation time to save your future self from a massive headache.
useradd -m -d /home/restricted/jdoe -s /usr/sbin/nologin -k /etc/skel_empty jdoe
⚙️ Why It Works
Passing the -k flag points the command to a custom skeleton directory, which lets you control exactly what files a user starts with instead of dumping default garbage into their profile. Setting the shell to nologin stops them from poking around if you only need them for a specific automated process.
🚀 Pro-Tip: Use chattr +i on the home directory if you need to be extra petty and prevent them from creating files at the root of their profile.
Linux Tips & Tricks | © ngelinux.com | 7/27/2026
