| 手法 | HISTFILE=/dev/null、HISTSIZE=0 |
|---|---|
| 位置 | .bashrc/.profile/系统 profile |
| 验证 | 检查运行 shell 的环境 |
| 信号 | 历史忽然缺失且配置文件被改 |
排查历史相关设置
排查历史相关设置
grep -rn 'HISTFILE\|HISTSIZE\|HISTCONTROL' /etc/profile /etc/bash.bashrc /root/.bashrc /root/.profile 2>/dev/null | head
tr '\0' '\n' < /proc/$(pgrep -u root -n bash)/environ 2>/dev/null | grep -i hist合法脚本也会 unset 历史变量(自动化场景常见),要与文件修改时间一起判断。