加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 在命令上运行shell脚本

发布时间:2020-12-13 18:20:35 所属栏目:Linux 来源:网络整理
导读:我希望在date -s string时运行 shell脚本使用命令.例如,我想通过在shell脚本中执行以下命令将命令记录到文件/tmp/user.log logger -p user.notice "date -s command executed" -f /tmp/user.log 如何在date -s string时运行shell脚本在shell上执行? 为了使
我希望在date -s< string>时运行 shell脚本使用命令.例如,我想通过在shell脚本中执行以下命令将命令记录到文件/tmp/user.log
logger -p user.notice "date -s command executed" -f /tmp/user.log

如何在date -s< string>时运行shell脚本在shell上执行?

为了使它更通用,我想在别人在我的系统上发出特定的linux命令时运行我的shell脚本.这该怎么做?

解决方法

换句话说,您想知道有人试图设置系统时间.这正是审计子系统的用途……它允许您审计特定系统调用的执行.在这种情况下,您希望知道何时有人调用可以更改系统时间的各种系统调用.通过使用审计子系统,您可以使用一个解决方案,无论是否有人正在调用/ bin / date或他们自己的本地构建版本的命令.

有关规则语法的完整说明,请参阅auditd(8)和audit.rules(7).有关审核时间更改操作的示例,您可以在示例nispom.rules文件中查找“时间更改”.您可以在本地系统上找到它,或者您可以在此处找到它:

> https://fedorahosted.org/audit/browser/trunk/contrib/nispom.rules

有关审计子系统的更多信息(文档有点难以获得):

> http://www.novell.com/documentation/sled10/pdfdoc/auditqs_sp2/auditqs_sp2.pdf
> http://doc.opensuse.org/products/draft/SLES/SLES-security/cha.audit.setup.html
> http://www.cyberciti.biz/tips/linux-audit-files-to-see-who-made-changes-to-a-file.html

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读