简体   繁体   English

使用 linux 终端通过 SSH 连接到亚马逊 Lightsail 实例

[英]Connect to amazon Lightsail instance via SSH using linux terminal

How can I connect to AWS LightSail instance?如何连接到 AWS LightSail 实例? AWS provides an web interface for doing this. AWS 提供了一个 web 接口来执行此操作。 But how can I do this with my terminal with SSH.但是我怎样才能用我的终端 SSH 做到这一点。

There are lots of documentations available for connecting from Windows with Putty.有很多文档可用于从 Windows 使用 Putty 进行连接。

  1. Login to AWS account(lightsail.aws.amazaon.com)登录 AWS 账户 (lightsail.aws.amazaon.com)
  2. Account -> Account账户 -> 账户
  3. Navaigate to "SSH Keys" tab导航到“SSH 密钥”选项卡
  4. Download the SSH Keys of the instance to which SSH connection to be made下载要建立 SSH 连接的实例的 SSH 密钥

    A pem file with such naming is downloaded LightsailDefaultKey------1.pem下载具有此类命名的 pem 文件 LightsailDefaultKey------1.pem

  5. Move the file to ~/.ssh/ location of your machine将文件移动到您机器的 ~/.ssh/ 位置
  6. Open the terminal and use the below command.打开终端并使用以下命令。
ssh -i ~/.ssh/LightsailDefaultKey------1.pem user@<public-ip>

Note: By the type of instance you have, use the corresponding username注意:根据您拥有的实例类型,使用相应的用户名

Amazon Linux, FreeBSD, and openSUSE instances: ec2-user Amazon Linux、FreeBSD 和 openSUSE 实例:ec2-user

CentOS instances: centos CentOS 实例:centos

Debian instances: admin Debian 实例:管理员

Ubuntu instances: ubuntu Ubuntu 实例:ubuntu

Bitnami instances: bitnami比特纳米实例:比特纳米

Plesk instances: ubuntu Plesk 实例:ubuntu

use @kernelogy answer but make sure you set permission to your ssh key使用@kernelogy answer 但请确保您设置了对您的 ssh 密钥的权限

chmod 400 LightsailDefaultKey.pem

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM