To find out what are the commands granted, just execute the sudo -l command, which essentially output all commands granted into a single long line.
If there are only few commands granted, that is fine to read out what are the commands granted, or find out any possible typo errors of the command name maintained in the /etc/sudoers file.
However, if there are few ten of commands granted, it is not that easy to read the sudo -l output, which list all the granted commands in a single line.
Well, there are two solutions to this irritating problem.
- Execute sudo -l | grep --color=auto tar command, which will highlight (in color) the matched keyword found in the single long line of commands granted.
- Download the wsudo.sh scripts file, which will breakdown individual commands output by sudo -l into multiple lines. Just type wsudo.sh to get a formatted version of sudo -l report, or pipe the output to grep or sort command. For example, wsudo.sh | grep tar or wsudo.sh | sort.
#!/bin/sh
sudo -l | grep --color=auto $1
Assuming this scripts file saved as wsudo file name, then to find out whether the tar command is granted, just type wsudo tar at command prompt.
Source:bloggerdigest.
No comments:
Post a Comment