您可能想以 root 用户身份登录 Lightsail 实例。以下是在不同操作系统上的操作方法。
Debian/Ubuntu:
a. 切换到根用户并设置根密码:
sudo su -
sudo passwd root
b. 配置 SSHD,允许 root 登录。
sudo sed -i '/PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
sudo sed -i '/PasswordAuthentication/s/^.*$/PasswordAuthentication yes/' /etc/ssh/sshd_config
c. 重新启动:
reboot
CentOS:
a. 切换到根用户并设置根密码:
sudo su -
sudo passwd root
b. 配置 SSHD,允许 root 登录。
sudo sed -i '/PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
sudo sed -i '/PasswordAuthentication/s/^.*$/PasswordAuthentication yes/' /etc/ssh/sshd_config
c. 重新启动:
reboot