I've set up a bash script to run automatically (from crontab) with sudo
privileges using this visudo
solution.
Since the script requires multiple runs, it pollutes my /var/log/auth.log
, so I disabled the TTY
output (only for the specific script I designated in visudo
) by following this solution successfully. By TTY
, I mean this kind of log entry: [user] : TTY=unknown ; PWD=... ; USER=root ; COMMAND=...
.
But I'm left with the following 2 lines in /var/log/auth.log
each time the script is run (it being run with sudo
privileges). Since it runs many times, I have this output many many times, which is annoying:
Nov 01 00:00:00 1234567 sudo: pam_unix(sudo:session): session opened for user root by (uid=0)
Nov 01 00:00:00 1234567 sudo: pam_unix(sudo:session): session closed for user root
I'm aware of this question: How to stop sudo PAM messages in auth.log for a specific user?, which seems to allow the disabling of PAM messages per user.
But I couldn't find a solution to disable the above PAM message in /var/log/auth.log
for a specific script only. Basically I'm looking for the equivalent of what I did for the TTY
output with visudo
, which carves-out from logging only the specific script I've designated.
Any ideas?
(The system is running Ubuntu 18.04 LTS)