案例一:显示 /etc/passwd 文件里的信息
# getent passwd root
(补充:这里以显示 /etc/passwd 文件里的 root 信息为例)
案例二:显示 /etc/hosts 文件里的信息
# getent host 127.0.0.1
(补充:这里以显示 /etc/hosts 文件里的 127.0.0.1 信息为例)
# getent passwd root
(补充:这里以显示 /etc/passwd 文件里的 root 信息为例)
# getent host 127.0.0.1
(补充:这里以显示 /etc/hosts 文件里的 127.0.0.1 信息为例)
放入 /dev/shm 的目录都是放入到内存中
当 /dev/shm 为空时其不会占用内存的空间
/dev/shm 的最大空间为内存的一半
系统重启后 /dev/shm 里的内容会被清空
shred 的作用是删除文件。和 rm 命令不同的是 shred 在删除前会通过多次 (默认 3 次) 覆盖的方式防止数据被删除
(
注意:
1) 多次覆写大文件会消耗较多时间和 I/O 资源
2) 由于 SSD 的磨损均衡技术,shred 在 SSD 上可能无法完全擦除数据
)
# shred <option> <file>
1) -n <覆写的次数>,设置覆写的次数
2) -z ,最后用零进行覆写,以隐藏 shred 命令的痕迹
3) -u ,覆写后删除文件
4) -v ,显示详细过程
5) -f ,强制写入,若需要则修改权限
6) -x ,不处理超过文件大小的块
# shred -n 5 -v test.txt
(补充:这里以覆写 5 次的方式删除 test.txt 文件为例)
# shred --random-source=/dev/urandom -v test.txt
(补充:这里以随机覆写次数的方式删除 test.txt 文件为例)
# dd if=/dev/zero of=test.txt bs=1M count=10
(补充:这里以每次容量是 1M,覆写文件 test.txt 10 次为例)
# wipe -r -q test.txt
(补充:以清除 test.txt 文件为例)
/run/credentials/ 目录下以 system 开头的文件都是只读文件
# ls -l /run/credentials/
total 0
dr-x------ 2 root root 0 Aug 30 20:36 systemd-sysctl.service
dr-x------ 2 root root 0 Aug 30 20:36 systemd-tmpfiles-setup-dev.service
dr-x------ 2 root root 0 Aug 30 20:36 systemd-tmpfiles-setup.service
......
# man 8 systemd-tmpfiles
# man 8 systemd-sysctl.service
# man 5 systemd.exec
# man 7 systemd.system-credentials
......
https://access.redhat.com/solutions/7024041
配置文件格式:
-w <file> -p wa -k <search_key>
命令格式:
# auditctl -w <file> -p wa -k <search_key>
(
补充:
1) 这里的 <file> 是要监控的文件
2) 这里的 <search_key> 是个标识,用于简化在 audit 日志里搜索此命令
)
配置文件的案例:
-w /etc/group -p wa -k group_file
命令案例:
# auditctl -w /etc/group -p wa -k group_file
(
补充:这里以
1) 监控 /etc/group 文件
2) 标识是 group_file 为例
)
# augenrules
# service auditd restart
# auditctl -l
# ausearch -k group_file
(补充:这里以查看标识为 group_file 的 audit 日志为例)
https://access.redhat.com/solutions/3401281