Suppose root user created a user say user1, and made entries in /etc/sudoers file for "user1" as "user1 ALL=(ALL) ALL". How can user1 check that he has privileges identical to root user ? Does it require to create a shell script for it ?
Asked
Active
Viewed 8,686 times
1 Answers
2
A user can see what he is allowed to run using sudo by running sudo -ll. No script is required. Below is an example:
$ sudo -ll
Matching Defaults entries for user1 on this host:
env_reset, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User user1 may run the following commands on this host:
Sudoers entry:
RunAsUsers: ALL
RunAsGroups: ALL
Commands:
ALL
To check if a certain command is allowed you can use sudo -l command. If the command is allowed the full path will be printed.
$ sudo -l ls
/bin/ls
To see what a different user is allowed to do you can add the option -U username.