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

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

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -