Issue
On my machine someone else is calling apt-get and aptitude many times over again.
How can I add a hook to see who called these? I've been looking everywhere, in crontabs and at many other places but didn't find any clues.
Solution
You could check their bash history, but it could be nothing shows up there.
Other option would be to hook into the apt-get command.
- Make a symlink for apt-get
cd /usr/bin
ln -s apt-get apt-get1
- in /etc/profile you can change global bash settings. Catch the apt-get command there and replace it with something that writes to syslog. Add this to the end of the file:
function apt-get () {
USER=$(who am i | awk '{print $1}' )
logger $USER " apt-get "
apt-get1 "$@"
}
Answered By - Alex