HowTo: Manage Sudo users commands and previleges

Posted on

If you want to prevent users from executing a specific command have a look at this.

ssh ALL=(user1) ALL, !/usr/bin/passwd 

Add users and use specific commands

#includedir /etc/sudoers.d

User_Alias JAVATEAM = fileupuser
Cmnd_Alias JUSERCMD =/etc/init.d/tomcat,/usr/bin/tail
JAVATEAM ALL = NOPASSWD : JUSERCMD
User_Alias ADMINTEAM = innouser
Cmnd_Alias SYSTEM =/sbin/service,/usr/sbin/ss,/bin/df,/usr/bin/du,/usr/bin/top,/bin/netstat,/usr/sbin/lsof,/bin/ps,/sbin/chkconfig
Cmnd_Alias FILEM =/bin/zcat,/usr/bin/tail,/bin/cat,/bin/grep
Cmnd_Alias COMPRESS =/usr/bin/unzip,/usr/bin/bzip2,/usr/bin/zip,/bin/tar
ADMINTEAM ALL = NOPASSWD : SYSTEM,FILEM,COMPRESS

this could be understand the logic easily.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s