校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 知識庫 > Linux系統下的用戶審計方法

Linux系統下的用戶審計方法

熱門標簽:常熟外呼系統 電銷語音機器人哪個好 江蘇小型外呼系統軟件 中山防封卡電銷卡辦理 地圖上標注點位的圖標 拉薩銷售外呼系統軟件 百度地圖標注未成功 文山外呼營銷系統 電話機器人服務器部署

創建審計日志目錄
 

復制代碼
代碼如下:
mkdir -p /var/log/user_audit

創建用戶審計日志文件;
 

復制代碼
代碼如下:
touch /var/log/user_audit/user_audit.log

將文件賦予低權限用戶
 

復制代碼
代碼如下:
chown nobody:nobody /var/log/user_audit/user_audit.log

賦予所有人寫權限
 

復制代碼
代碼如下:
chmod 002 /var/log/user_audit/user_audit.log

賦予所有用戶追加權限
 

復制代碼
代碼如下:
chattr +a /var/log/user_audit.log

編輯/etc/profile 增加以下內容;
 

復制代碼
代碼如下:
export HISTORY_FILE=/var/log/user_audit/user_audit.log
export PROMPT_COMMAND='{ date "+%y-%m-%d %T ##### $(who am i |awk "{print \$1\" \"\$2\" \"\$5}")

實例
多人共同使用的服務器權限確實不好管理,誤操作等造成故障,無法追究,最好的辦法就是將用戶操作實時記錄到日志,并推送到遠程日志服務器上。包括(用戶登陸時間,目錄,操作命令及時間戳等)。以便事后追查。
環境:centos5.5 X86_64 2臺              #備注:把兩臺主機的防火墻和selinux關閉。在進行操作。
(一)日志服務器IP:10.0.2.164
(二)客戶端服務器IP:10.0.2.165
1.先在日志服務器10.0.2.164主機上操作:

復制代碼
代碼如下:
[root@MySQL-B ~]# echo "*.info /var/log/client" >> /etc/syslog.conf
#配置日志保存文件,把該文件第一行的*.info 提出來。單獨放一行。
[root@MySQL-B ~]# service syslog restart #重啟syslog日志服務。
Shutting down kernel logger: [ OK ]
Shutting down system logger: [ OK ]
Starting system logger: [ OK ]
Starting kernel logger: [ OK ]
[root@MySQL-B ~]# vim /etc/sysconfig/syslog #接收客戶端寫入。

把SYSLOGD_OPTIONS="-m 0"  更改為:SYSLOGD_OPTIONS="-m 1 -r"
2.然后在客戶端服務器10.0.2.165主機上操作:

復制代碼
代碼如下:
[root@MySQL-A ~]# vim /etc/profile #添加如下行。
export PROMPT_COMMAND='{ msg=$(history 1 | { read x y; echo $y; });logger "[euid=$(whoami)]":$(who am i):[`pwd`]"$msg"; }'
[root@MySQL-A ~]# source /etc/profile #重新手動source更新。

2.1.客戶機修改日志服務器10.0.2.165主機上操作:

復制代碼
代碼如下:
[root@MySQL-A ~]# echo "10.0.2.164 logserver" >> /etc/hosts #日志服務器地址。
[root@MySQL-A ~]# echo "*.info @logserver" >> /etc/syslog.conf
#將info日志推送到日志服務器,把該文件第一行的*.info 提出來。單獨放一行。
[root@MySQL-A ~]# /etc/init.d/syslog restart #重啟syslog日志。
Shutting down kernel logger: [ OK ]
Shutting down system logger: [ OK ]
Starting system logger: [ OK ]
Starting kernel logger: [ OK ]

3.測試,在客戶端主機上10.0.2.165主機上測試并操作:                     

復制代碼
代碼如下:
[root@MySQL-A ~]# test
[root@MySQL-A ~]# echo "this is a test 1"
this is a test 1
[root@MySQL-A ~]# echo "this is a test 2"
this is a test 2
[root@MySQL-A ~]# echo "this is a test 3"
this is a test 3
[root@MySQL-A ~]# echo "this is a test 4"
this is a test 4
[root@MySQL-A ~]# echo "this is a test 5"
this is a test 5

4.返回日志服務器10.0.2.164主機上看結果,是否記錄下來客戶端主機執行的操作?

復制代碼
代碼如下:
[root@MySQL-B ~]# cat /var/log/client
Apr 6 10:37:55 10.0.2.165 root: [euid=root]:root pts/1 Apr 6 10:37 (10.0.2.188):[/root]echo "this is a test1"
Apr 6 10:37:59 10.0.2.165 root: [euid=root]:root pts/1 Apr 6 10:37 (10.0.2.188):[/root]echo "this is a test2"
Apr 6 10:38:01 10.0.2.165 root: [euid=root]:root pts/1 Apr 6 10:37 (10.0.2.188):[/root]echo "this is a test3"
Apr 6 10:38:04 10.0.2.165 root: [euid=root]:root pts/1 Apr 6 10:37 (10.0.2.188):[/root]echo "this is a test4"
Apr 6 10:38:06 10.0.2.165 root: [euid=root]:root pts/1 Apr 6 10:37 (10.0.2.188):[/root]echo "this is a test5"

返回參數分別為:#操作時間  #操作IP  #有效用戶  #實際登陸時間  #路徑  #使用的命令

標簽:法律問答 石家莊 和田 和田 馬鞍山 淮安 開封 湖南

巨人網絡通訊聲明:本文標題《Linux系統下的用戶審計方法》,本文關鍵詞  Linux,系統,下,的,用戶,審計,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《Linux系統下的用戶審計方法》相關的同類信息!
  • 本頁收集關于Linux系統下的用戶審計方法的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 旌德县| 蕲春县| 昭觉县| 固安县| 锦州市| 佛教| 抚州市| 遵义县| 原平市| 司法| 涿鹿县| 茌平县| 苍南县| 宁津县| 峨山| 舞钢市| 明水县| 彭山县| 枣阳市| 班玛县| 石渠县| 富裕县| 苍南县| 清新县| 恩平市| 金平| 古田县| 锦屏县| 长垣县| 青冈县| 英德市| 邵武市| 莒南县| 神池县| 如皋市| 建昌县| 哈密市| 普宁市| 望江县| 米林县| 额济纳旗|