Skip to content
Eternal Center

Eternal Center

  • Single-Node (单节点)
    • System (系统)
    • Service (服务)
    • Database (数据库)
    • Container (容器)
    • Virtualization (虚拟化)
  • Multi-Node (多节点)
    • Cluster (集群)
    • Big Data (大数据)
    • Cloud Computing (云计算)
    • Batch Processing (批量处理)
  • Approach (方式方法)
    • Languages (语言)
    • Ideas (思路)
    • Programing (编程)
    • Project (项目)
  • Eternity (永恒)
    • News (消息)
    • Creations (创作)
    • Classics (经典)
    • Legends (传说)
    • Chronicle (编年史)
    • FNIOS (宇宙公民开源学院)
Posted on July 8, 2023November 22, 2024 by Mingyu Zhu

[步骤] Linux 所有非 root 用户操作的监控

  • 步骤一:配置 /etc/profile 文件
    • 1.1 配置 /etc/profile 文件
    • 1.2 让刚刚的配置生效
  • 步骤二:创建 /var/log/script-records 目录
    • 2.1 创建 /var/log/script-records 文件
    • 2.2 配置 /var/log/script-records 文件的配置文件

步骤一:配置 /etc/profile 文件

1.1 配置 /etc/profile 文件

# vim /etc/profile

添加以下内容:

......
if [ $UID -ge 0 ]
then
    exec -a -f -q /var/log/script-records/$USER-$UID-`date +%Y%m%d`.log
fi

(补充:这里以把所有非 root 用户的操作写入 /var/log/script-records/$USER-$UID-date +%Y%m%d.log 文件为例)

1.2 让刚刚的配置生效

# source /etc/profile

或者:

# reboot

步骤二:创建 /var/log/script-records 目录

2.1 创建 /var/log/script-records 文件

# mkdir /var/log/script-records

2.2 配置 /var/log/script-records 文件的配置文件

# chmod 750 /var/log/script-records
CategoriesChinese Post (中文帖子), System (系统), System General Log (系统普通日志), System Log (系统日志), System Login Security (系统登录安全), System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志), System Operation & System Setting & System Software (系统操作 & 系统设置 & 系统软件), System Security Log (系统安全日志), System Setting (系统设置), System Setting Other Steps (系统设置其它步骤), System Setting Others (系统设置其它), System User (系统用户), System User & System Privilege (系统用户 & 系统权限)

Post navigation

Previous PostPrevious [内容] Linux 查看 auditd 日志的案例
Next PostNext [命令] Linux 命令 script (记录用户的所有操作和操作的输出结果)

Aspiration (愿景):

Everyone can achieve self-achievement and self-happiness fairly

每个人都能公平地实现自我成就和自我幸福

Logo (徽标):

Additional Information (其他信息):

About     Manual     Clone     Contact
Disclaimer     Friendly Links     Donation

关于     手册     克隆     联系
免责声明     友情链接     捐赠

Search Inside Website (站内搜索)

Search Outside Website (站外搜索):

Google         Wikipedia         Bing

Eternal URL (永恒网址):

https://eternity.eternalcenter.com Will be last access method / 将是最后的访问方式

Proudly powered by LNMP Proudly powered by WordPress