步骤一:开启软硬链接保护
1.1 修改 /etc/sysctl.conf 文件
# vim /etc/sysctl.conf
添加以下内容:
......
fs.protected_hardlinks = 1
fs.protected_symlinks = 1
1.2 设置系统正在运行的 fs.protected_symlinks 参数和 fs.protected_hardlinks 参数
# sysctl -w fs.protected_symlinks = 1
# sysctl -w fs.protected_hardlinks = 1
步骤二:显示软硬链接保护的开启状态
2.1 显示 /etc/sysctl.conf 文件里的 fs.protected_symlinks 参数和 fs.protected_hardlinks 参数
# grep "fs\.protected_hardlinks" /etc/sysctl.conf /etc/sysctl.d/*
fs.protected_hardlinks = 1
# grep "fs\.protected_symlinks" /etc/sysctl.conf /etc/sysctl.d/*
fs.protected_symlinks = 1
2.2 显示系统正在运行的 fs.protected_symlinks 参数和 fs.protected_hardlinks 参数
# sysctl fs.protected_symlinks
fs.protected_symlinks = 1
# sysctl fs.protected_hardlinks
fs.protected_hardlinks = 1