Given that /etc/sudoers and /etc/sudoers.d/ are not readable by regular users, is there a way that I, as a normal user, can find out what sudo permissions I have?


3 Answers 3


Use sudo -l to get your access rights. The output might look like this:

#> sudo -l
Matching Defaults entries for myuser on myhost:
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, !fqdn,

User myuser may run the following commands on myhost:
    (root) NOPASSWD: /usr/bin/systemctl restart docker
    (root) NOPASSWD: /usr/bin/systemctl restart docker.service

If you do not have access rights, it asks for password and writes a message:

#> sudo -l
[sudo] password for myuser:
Sorry, user myuser may not run sudo on myhost.

Run sudo -l.

Depending on how sudo is configured on your system, it might request your password first, but it will display all sudo configuration options that apply to your account, and then all the permitted command definitions applicable to you.


Create a script to traverse $PATH, looking for executables, and run it with sudo to look at the sudo environment. Also remember that one can use an absolute path: sudo /media/walt/newsys/install.

Something like:

find $( echo "$PATH" | tr ':' ' ') -type f -executable -print | \

Run this both with sudo and without.

  • 3
    This won't help if (as is quite likely in the OP's case) the script you've just written isn't one of the scripts that sudo is set up to allow you to run.
    – psmears
    Jan 12 at 12:14
  • sudo can restrict not just which commands you can run, but which command-line options you can use.
    – Mark
    Jan 17 at 1:20

Not the answer you're looking for? Browse other questions tagged .