sudo passwd root #输入2次密码给root用户设定密码
su -
passwd ec2-user #输入两次密码给ec2-user用户设定密码
sed -ri 's/^#?(PasswordAuthentication)\s+(yes|no)/\1 yes/' /etc/ssh/sshd_config
sed -ri 's/^#?(PermitRootLogin)\s+(yes|no)/\1 yes/' /etc/ssh/sshd_config #修改配置文件
sed -ri 's/^/#/;s/sleep 10"\s+/&\n/' /root/.ssh/authorized_keys
重启实例
使用ubuntu或者其他非root用户连接

相关文章:

  • 2021-08-14
  • 2021-07-23
  • 2021-07-14
  • 2021-12-26
猜你喜欢
  • 2021-11-16
  • 2021-04-30
  • 2021-04-11
  • 2022-12-23
  • 2021-11-20
相关资源
相似解决方案