How to enable root ssh in Amazon Lightsail instance

Amazon lightsail instances do not allow ssh root access by default. You have to log in as user “ubuntu” or “ec2-user”, then use the command “sudo” to become user root. This is done for security. There are some circumstances where you need to enable direct SSH login to lightsail server.

How to enable root ssh in ubuntu lightsail instgance

Login as user ubuntu, then edit the file

In the file, you will notice the default ssh key has already been added. But in the front the line, you have the following string

You need to remove this text, so you have the ssh key remaining in the file. SSH public key starts with the text ssh-rsa.

Now you should be able to log in to the server with SSH user root and default ssh key file (pem file).

Back to Amazon Lightsail

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *