Skip to Content
Mastering Linux Security and Hardening - Second Edition
book

Mastering Linux Security and Hardening - Second Edition

by Donald A. Tevault
February 2020
Intermediate to advanced
666 pages
15h 45m
English
Packt Publishing
Content preview from Mastering Linux Security and Hardening - Second Edition

Preventing abuse via user's shell scripts

So, what if a user has written a shell script that requires sudo privileges? To answer that, let's have Frank create the frank_script.sh shell script that looks like this:

#!/bin/bashecho "This script belongs to Frank the Cat."

Okay, he wouldn't need sudo privileges for that, but let's pretend that he does. After he sets the executable permission and runs it with sudo, the output will look like this:

 frank@packtpub1:~$ sudo ./frank_script.sh [sudo] password for frank: Sorry, user frank is not allowed to execute './frank_script.sh' as root on packtpub1.tds. frank@packtpub1:~$

So, naturally frustrated, Frank requested that I create a sudo rule so that he can run the script. So, I open visudo and add ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Linux Security and Hardening - Third Edition

Mastering Linux Security and Hardening - Third Edition

Donald A. Tevault
UNIX and Linux System Administration Handbook, 5th Edition

UNIX and Linux System Administration Handbook, 5th Edition

Trent R. Hein, Evi Nemeth, Garth Snyder, Ben Whaley, Dan Mackin

Publisher Resources

ISBN: 9781838981778Supplemental Content