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
demandé il y a 7 mois369 vues
2 réponses
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
répondu il y a 7 mois
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
répondu il y a 7 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions