linux审计相关

114 篇文章 0 订阅
19 篇文章 0 订阅

1.2.6的audit


/var/log/audit/audit.log


2.sa / lastcomm /accton


/var/account/pacct  不过默认把这个放在/var/log下面好切分


3.用script -f 来记录

http://hi.baidu.com/ubuntu2me/blog/item/7e6d86cf7c77e70f93457e4d.html

有时候我们需要记录Linux用户的操作记录用于审计,因此就要避免用户可以自行清除操作日志,一个简单的方式是使用script功能。

首先在用户的profile文件中开启记录功能:

[banping@linux ~]$ cd /home/banping/
[banping@linux ~]$ vi .bash_profile
# write log
exec /usr/bin/script -a -f -q /tmp/test/script-`date +%Y%m%d%k%M`.lst

这行脚本的意思是在/tmp/test目录下以时间为文件名来记录操作信息,由于是写在了.bash_profile文件中,用户登入到Linux 系统的时候就会触发执行。

然后我们在/tmp下建立test目录存放操作日志信息即可:

[banping@linux tmp]# mkdir test

这样就实现了记录的功能,而要防止用户自行修改,我们可以设置这些文件只能被附加,不能被修改或删除:

[root@linux banping]# chattr +a .bash_profile

[root@linux tmp]# chattr +a -R test

这样登录用户就无法修改这些信息了,以下是一个简单的测试:

[root@tomcat tmp]# cd test
[root@tomcat test]# touch 1.txt
[root@tomcat test]# rm 1.txt
rm: remove regular empty file `1.txt'? y
rm: cannot remove `1.txt': Operation not permitted
[root@tomcat test]# cd ..
[root@tomcat tmp]# chattr -a -R test
[root@tomcat tmp]# cd test
[root@tomcat test]# rm 1.txt
rm: remove regular empty file `1.txt'? y
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值