WhiteIntel
WhiteIntel

Reputation: 697

Log commands for ssh session

is there a way to log the commands that every user typed in their ssh session automatically and put it to a log file?

I´m using ubuntu server 12.04.

greetings White

Upvotes: 1

Views: 2053

Answers (2)

Derrick Johnson
Derrick Johnson

Reputation: 385

Check out SSHLog: https://github.com/sshlog/agent/

I think that's exactly what you're looking for. It's a daemon that monitors SSH user activity. All user activity (everything that happens on the shell) is by default recorded to log files for each session.

Upvotes: 0

Jain Rachit Kumar
Jain Rachit Kumar

Reputation: 4287

You can use "scripts" command for same , basically you have add command "script -a " to the profile file for each user you have on your system (profile file /home/user/.bash_profile) .

Please be informed that script will also dump the command output to the file as well, and user need to do exit twice to close the session.

"man script" for more information.

Regards, Jain

Upvotes: 1

Related Questions