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
질문됨 7달 전370회 조회
2개 답변
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
답변함 7달 전
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
답변함 7달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠