I have a server set-up and I let somebody that I trust with a little bit of sudo access have it. However, I also want an email anytime that they use sudo.
I know that I can use Defaults mail_always to get an email anytime ANYONE tries to use sudo, but I have a cron-job for OwnCloud that runs every 30 minutes and requires a sudo -u www-data at the beginning of it. Obviously, I don't want an email every 30-minutes.
How can I always get an email just for 1 specific user?
sudo /bin/bashwill be tracked, but commands passed to therootbashwon't be. Similarly,sudo vi foo, followed by:!rm /etc/passwdwill not be logged. Rereadman sudoers. You can set up sudo so that it will allow a single command, without a password. – waltinator May 09 '16 at 12:22sudofor single commands, or just a few commands. I've already done that. I just also wanted an email anytime one of those commands was used withsudoby that specific user. This solved my problem by achieving exactly what my question asked. – May 09 '16 at 15:13