If I:
[user@notebook ~] sudo echo 123456uu
123456uu
[user@notebook ~]
Then I can see that in the logs:
[root@notebook /var/log] grep 123456uu *
auth.log:Jan 9 17:01:51 notebook sudo: user : TTY=pts/3 ; PWD=/home/user ; USER=root ; COMMAND=/bin/echo 123456uu
[root@notebook /var/log]
but if I:
[user@notebook ~] sudo su -
[root@notebook ~] echo 1234567zz
1234567zz
[root@notebook ~]
I cannot see it in the logs:
[root@notebook /var/log] grep 1234567zz *
[root@notebook /var/log] echo $?
1
[root@notebook /var/log]
My question: How can I turn the logging on for the commands within the "sudo su -"?
OS is an Ubuntu 12.04 but the question is in general.
UPDATE#1:
[user@notebook ~] sudo su -
[sudo] password for user:
[root@notebook ~] echo zizizi
zizizi
[root@notebook ~] cd /var/log
[root@notebook /var/log] grep -iIR 'zizizi' *
[root@notebook /var/log] grep 'COMMAND=/bin/su -' *
auth.log:Jan 10 15:42:42 notebook sudo: user : TTY=pts/1 ; PWD=/home/user ; USER=root ; COMMAND=/bin/su -
[root@notebook /var/log]
sudo su -
, they also have the ability to remove all the log entries you could make of their actions. If you want 100% certainty in your logging, you need to restrictsudo
heavily and disallowsudo su
entirely. – Wildcard Apr 09 '16 at 00:05