Lightsail: keys and passwords

0

There is a public key to use Lightsail. How can I log in to the server with a password, without using keys?

RustemA
asked 7 months ago337 views
2 Answers
1

Hi, Lightsail produces a default key pair for you in each AWS Region where you build instances by default. At any moment, you may download the private key of the default key pair from the Lightsail interface. You may also use the Lightsail interface or a third-party application like ssh-keygen to generate or upload your own unique key pairs.

To address your query, there is no method to access your Lightsail instance without utilizing keys. This is due to the fact that SSH password authentication is disabled for security reasons. However, certain Lightsail instances may save automatically created application credentials to the file system in a password file. After connecting to the instance through SSH with the SSH key, you may examine this password file. If you have a WordPress instance, for example, you can locate the WordPress password in the bitnami_application_password file.

I hope this helps.

profile picture
answered 7 months ago
1

To SSH login with password, you need to modify the SSH server's settings and password for your user (e.g., ec2-user).

# Change SSH server's settings
echo "PasswordAuthentication yes" | sudo tee /etc/ssh/sshd_config.d/custom.conf
sudo systemctl restart sshd

# Change ec2-user's password
echo 'ec2-user:P@ssw0rd' | sudo chpasswd

You can set those commands as a launch script if you want to apply settings for your new Lightsail instances.

Lightsail

Now you should be able to SSH to your instances with your password.

$ ssh ec2-user@54.250.7.64
The authenticity of host '54.250.7.64 (54.250.7.64)' can't be established.
ECDSA key fingerprint is SHA256:s6mxI2WFYiKjRYH+bDCc7xq42B6unUNSf76G42bsO0I.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '54.250.7.64' (ECDSA) to the list of known hosts.
ec2-user@54.250.7.64's password: 
   ,     #_
   ~\_  ####_        Amazon Linux 2023
  ~~  \_#####\
  ~~     \###|
  ~~       \#/ ___   https://aws.amazon.com/linux/amazon-linux-2023
   ~~       V~' '->
    ~~~         /
      ~~._.   _/
         _/ _/
       _/m/'
[ec2-user@ip-172-26-8-27 ~]$ 
profile picture
HS
answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions