Get command history from remote user on Linux server

I have a Linux server and many users can access this by ssh. I need to get all history commands from users:

 - Date: the time of execution
 - Pwd: executable directory
 - Remote host ip
 - User
 - Command

Upvotes: 0

Views: 1076

Answers (1)

bitinerant
bitinerant

Reputation: 1571

It's too long to summarize here, but this blog post gives the code and description for setting up a system that logs everything that users do on a system:

Howto – bash audit / command logger

I've been using this personally for years and have found it invaluable.

As you requested, it logs date, time, current directory, user, and command. The IP address should be available in /var/log/auth.log

Update: Since writing the above, I put my 'fork' of this on GitLab: bash_franzi

Upvotes: 1

Related Questions