安全加固涉及主机加固和容器应用加固,用于防止可能出现的安全隐患,保障设备和容器应用的安全,请用户根据实际需要进行安全加固操作。
执行cat /etc/sudoers | grep -E "^[^#]*Defaults[[:space:]]+targetpw"命令检查是否存在“Defaults targetpw”或“Defaults rootpw”配置项。如果不存在,请在“/etc/sudoers”文件的“#Defaults specification”下添加“Defaults targetpw”或者“Defaults rootpw”配置项。
执行cat /etc/sudoers命令检查“/etc/sudoers”文件中是否存在“root ALL=(ALL:ALL) ALL”和“root ALL=(ALL) ALL”之外的其他用户或组的(ALL) ALL和(ALL:ALL) ALL。如果存在,请根据实际业务场景确认是否需要,如果确认不需要,请删除。例如user ALL=(ALL) ALL、%admin ALL=(ALL) ALL或%sudo ALL=(ALL:ALL) ALL。