Write shell script that can only be run by a sudo user in Ubuntu -


i'm writing shell script supposed run users in sudo user list, what's appropriate way of doing this?

what i'm thinking in shell script, try create dummy file in system dir such /var/run/ , remove it, users not in sudo list receive permission error, believe there gotta more appropriate way of doing this, helping

you can check values of $uid , $euid in script. 0 being equivalent root. or, if not bash, can use id -u.


Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -