Friday, December 16, 2016

How to check sudo access available for a Normal user ?

Method 1:
sudo  -v

Example
deb@linuxforfreshers:~$ sudo  -v
Sorry, user deb may not run sudo on LINUXFORFRESHERS.

Method 2:
sudo -l This will list any sudo privileges you have.

Example:
deb@linuxforfreshers:~$ sudo -l
[sudo] password for deb:           
Sorry, user deb may not run sudo on LINUXFORFRESHERS.

Method 3:
If you are a root privileged user using following command u should get the which user has which sudo permissions
Syntax : sudo -l -U username

Example 1:
ram@linuxforfreshers:~$ sudo -l –U srini
User srini is not allowed to run sudo on LINUXFORFRESHERS.

Example 2:
ram@linuxforfreshers:~$ sudo -l -U ansible
Matching Defaults entries for ansible on LINUXFORFRESHERS:
    env_reset, pwfeedback, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User ansible may run the following commands on LINUXFORFRESHERS:
    (ALL : ALL) NOPASSWD: ALL









No comments:

Post a Comment