千家信息网

设置ssh证书登录,禁止root登录,禁止su到root,sudo权限设置

发表于:2026-10-31 作者:千家信息网编辑
千家信息网最后更新 2026年10月31日,一、设置ssh证书登录,禁止root登录useradd newuserpasswd newuservim /etc/ssh/sshd_configPermitRootLogin noRSAAuthen
千家信息网最后更新 2026年10月31日设置ssh证书登录,禁止root登录,禁止su到root,sudo权限设置

一、设置ssh证书登录,禁止root登录

useradd newuserpasswd newuservim /etc/ssh/sshd_configPermitRootLogin noRSAAuthentication yesPubkeyAuthentication yesPasswordAuthentication noClientAliveInterval 30ClientAliveCountMax 5

二、禁止su

vim /etc/pam.d/suauth            required        pam_wheel.so use_uidvim /etc/login.defsSU_WHEEL_ONLY yes

三、sudo权限设置

chmod 640 /etc/sudoersvim /etc/sudoerslity    ALL=(ALL)       ALLchmod 440 /etc/sudoers
0