How to execute a script as super user first checking the user and getting pass from askpass if not super user

Posted by pahnin on Ask Ubuntu See other posts from Ask Ubuntu or by pahnin
Published on 2011-03-13T14:11:20Z Indexed on 2011/03/13 16:17 UTC
Read the original article Hit count: 220

Filed under:
|
|

thers a similar question out there How can I determine whether a shellscript runs as root or not?

I have the same doubt with different result

Is it possible to, within the BASH script prior to everything being run, check if the script is being run as superuser, and if not, print a message saying You must be superuser to use this script, then subsequently

get pass from the user using askpass or something like tht then execute the saem script as superuser?

© Ask Ubuntu or respective owner

Related posts about bash

Related posts about root