super user privileges check for a normal user in bash script
Hi,
I want to check if a normal user has super user privileges. For example, I run a script as user bond: Code:
bond $ ./run.sh Is it possible? Consider I can't read /etc/sudoers file. I don't wan't to ask for password and then fail. I just want to say: "You don't have sudo privileges... aborting" Thanks, Indy |
No you cannot do this. The problem is that anyone CAN run the sudo command, but until authentication it is not known what privileges they have. What you can do is grab the password and run a `CMD_LIST=$(echo $PASSWD | sudo -L -S)` and process the output and/or exit code to determine if they have necessary rights.
|
ok.
that's a bummer, but not much one can do. Thanks jcookeman Indy |
All times are GMT -5. The time now is 02:07 AM. |