Paranoid Penguin - Linux Filesystem Security, Part II

We covered the fundamentals of permissions last month. Now it's time to learn some useful bits to make cooperation among users convenient and secure.

Save and exit the file.

Now, to do his thing, crash enters the command:

sudo rm /home/biff/extreme_casseroles/pineapple_mushroom_surprise.txt

whereupon he is prompted to enter his password. After he enters this correctly, the command:

/bin/rm /home/biff/extreme_casseroles/pineapple_mushroom_surprise.txt

is executed as root, and the offending file is gone.

Alternately, the line in /etc/sudoers could look like this:

crash localhost=/bin/rm /home/biff/extreme_casseroles/*

That way, crash can delete anything in extreme_casseroles/, regardless of the sticky bit setting.

As handy as it is, sudo is a powerful tool, so use it wisely; root privileges never should be trifled with. It really is better to use user and group permissions judiciously than to hand out root privileges, even with sudo. Better still, use an RBAC-based system such as SELinux if the stakes are high enough.

That's it for now. I hope you've found this tutorial useful. Until next time, be safe!

Mick Bauer, CISSP, is Linux Journal's security editor and an IS security consultant in Minneapolis, Minnesota. He's the author of Building Secure Servers With Linux (O'Reilly & Associates, 2002).



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


Trupti's picture

Helpful post. Every bit is covered here.Thank you.

Geek Guide
The DevOps Toolbox

Tools and Technologies for Scale and Reliability
by Linux Journal Editor Bill Childers

Get your free copy today

Sponsored by IBM

8 Signs You're Beyond Cron

Scheduling Crontabs With an Enterprise Scheduler
On Demand
Moderated by Linux Journal Contributor Mike Diehl

Sign up and watch now

Sponsored by Skybot