From which log can I get details about sudo commands executed by any user. It should contain the working directory, command, user.
It will be helpful if you could provide me a shell script to do so
Details about sudo commands executed by all user
logssudo
Best Answer
Depending on your distro; simply:
or
which gives:
The user running the command is after the
sudo:
-gareth
in this case.PWD
is the directory.USER
is the user thatgareth
is running as -root
in this example.COMMAND
is the command ran.Therefore, in the example above,
gareth
usedsudo
to runyum update
and then ran this example. Before that he typed in the incorrect password.On newer systems:
gives a very similar output.