B
B
by_EL2020-11-25 00:44:54
linux
by_EL, 2020-11-25 00:44:54

How to see the history of what commands were executed on behalf of sudo (root) on linux?

Somewhere I read that what commands we run on behalf of sudo, then the launch of this command is logged in the log file. But I don't remember this file. Please, help.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
galaxy, 2020-11-25
@galaxy

In ubuntu (probably also in debian) it is written to /var/log/auth.log:

Nov 25 01:12:08 host.domain sudo:   galaxy : TTY=pts/1 ; PWD=/home/user ; USER=root ; COMMAND=/bin/bash

On other systems, they can write to other files (/var/log/secure.log, etc.) or to syslog.
It says here how to log the input and output of commands, which allows you to even see what was done aftersudo su -

M
Mikhail Vasilyev, 2020-11-25
@vasilyevmn

~/. bash_history

F
Fenrir89, 2020-11-25
@Fenrir89

/root/.bash_history

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question