简体   繁体   English

从Linux服务器上的远程用户获取命令历史记录

[英]Get command history from remote user on Linux server

I have a Linux server and many users can access this by ssh . 我有一个Linux服务器,许多用户可以通过ssh访问它。 I need to get all history commands from users: 我需要从用户那里获取所有history commands

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

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 Howto – bash审核/命令记录器

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 IP地址应该在/var/log/auth.log中可用

Update : Since writing the above, I put my 'fork' of this on GitLab: bash_franzi 更新 :自从编写以上内容以来,我将其“叉子”放在GitLab上: bash_franzi

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM