站点图标 Lee's Blog

AWS Lightsail 开启 Root 登陆权限

将下面代码中的第一句中的 Passwd 改为自己将要设置的密码,否则默认 root 密码为 Passwd

#!/bin/bash
echo root:Passwd |sudo chpasswd root
sudo sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;
sudo sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config;
sudo reboot
退出移动版