After AWS Lightsail uses the key to log in through ssh, you can also log in with a password by setting the root user. Let’s take a look at how AWS Lightsail sets up a root user and logs in with a password.
1.Log in and connect to the AWS Lightsail server according to the method provided on the official website(KEY).
2.Create a root password and enter the following command:
sudo su passwd root
3.Then you will be prompted to enter new password. Enter a root password you want to set, you need to enter it again for verification.
4.Next, Use root identity to edit the ssh login method of Amazon cloud host, enter:
5.Find PasswordAuthentication no, change no to yes (note that this is not PublicKeyAuthentication).
PermitRootLogin yes PasswordAuthentication yes
6.Then change the value of PermitRootLogin to yes
7.finally restart the server.
At this point, you can log in to the AWS Lightsail server directly as root.