AWS Azure GCP设置口令登陆
更改root密码
passwd root
#设置启动密码认证
sed -ri 's/^#?(PasswordAuthentication)\s+(yes|no)/\1 yes/' /etc/ssh/sshd_config
#设置允许root账号登陆
sed -ri 's/^#?(PermitRootLogin)\s+(yes|no|prohibit-password)/\1 yes/' /etc/ssh/sshd_config
#设置关闭公私密钥登陆只启用口令登陆
(需要设置密钥和口令并存跳过)
sed -ri 's/^#?(PubkeyAuthentication)\s+(yes|no)/\1 no/' /etc/ssh/sshd_config
#重启ssh服务
service sshd restart
#ssh配置文件位置 /etc/ssh/sshd_config
AWS Azure GCP关闭口令登陆
#设置取消密码认证
sed -ri 's/^#?(PasswordAuthentication)\s+(yes|no)/\1 no/' /etc/ssh/sshd_config
#设置不允许root账号登陆
sed -ri 's/^#?(PermitRootLogin)\s+(yes|no|prohibit-password)/\1 no/' /etc/ssh/sshd_config
#设置开启公私密钥登陆关闭口令登陆
sed -ri 's/^#?(PubkeyAuthentication)\s+(yes|no)/\1 yes/' /etc/ssh/sshd_config
#重启ssh服务
service sshd restart
#AWS #azure #gcp
更改root密码
passwd root
#设置启动密码认证
sed -ri 's/^#?(PasswordAuthentication)\s+(yes|no)/\1 yes/' /etc/ssh/sshd_config
#设置允许root账号登陆
sed -ri 's/^#?(PermitRootLogin)\s+(yes|no|prohibit-password)/\1 yes/' /etc/ssh/sshd_config
#设置关闭公私密钥登陆只启用口令登陆
(需要设置密钥和口令并存跳过)
sed -ri 's/^#?(PubkeyAuthentication)\s+(yes|no)/\1 no/' /etc/ssh/sshd_config
#重启ssh服务
service sshd restart
#ssh配置文件位置 /etc/ssh/sshd_config
AWS Azure GCP关闭口令登陆
#设置取消密码认证
sed -ri 's/^#?(PasswordAuthentication)\s+(yes|no)/\1 no/' /etc/ssh/sshd_config
#设置不允许root账号登陆
sed -ri 's/^#?(PermitRootLogin)\s+(yes|no|prohibit-password)/\1 no/' /etc/ssh/sshd_config
#设置开启公私密钥登陆关闭口令登陆
sed -ri 's/^#?(PubkeyAuthentication)\s+(yes|no)/\1 yes/' /etc/ssh/sshd_config
#重启ssh服务
service sshd restart
#AWS #azure #gcp