Use to connect to AWS EC2 instance
Use to connect to AWS EC2 instance
使用连接AWS EC2实例1: Create a new key pairOpen the Amazon EC2 cole at /.In the navigation pane, choose Key Pairs.Choose Create key pair.For Key pair name, enter
Use to connect to AWS EC2 instance
使用连接AWS EC2实例
- Open the Amazon EC2 cole at /.
- In the navigation pane, choose Key Pairs.
- Choose Create key pair.
- For Key pair name, enter a name for the new key pair, and then choose Create key pair.
- Your browser will download the private key file automatically. The private key file is automatically downloaded by your browser. The base file name is the name you specified as the name of your key pair, and the file name extension is .pem. Save the private key file in a safe place.
- Choose Close.
- Important: You can create a key pair only once. Be sure to save the private key file to your computer. You’ll need to provide the name of your key pair when you launch an instance and the corresponding private key each time you connect to the instance.
- Open a terminal window.
- Use the
cd
command to navigate to the directory where your private key file is located. - Use the following command to set the permissi of your private key file so that only you can read it:
chmod 400 /path/my-key-pair.pem
- Use the following command to connect to your instance. Replace
ec2-user
with the appropriate user name for your AMI.
- For Amazon Linux 2 or the Amazon Linux AMI, the user name is
ec2-user
. - For a CentOS AMI, the user name is
centos
. - For a Debian AMI, the user name is
admin
. - For a Fedora AMI, the user name is
ec2-user
orfedora
. - For a RHEL AMI, the user name is
ec2-user
orroot
. - For a SUSE AMI, the user name is
ec2-user
orroot
. - For an Ubuntu AMI, the user name is
ubuntu
. Here my OS is Ubuntu. - Otherwise, if
ec2-user
androot
don’t work, check with your AMI provider.
-i /path/my-key-pair.pem user_name@ip_address
Open a terminal window.
Use the following command to connect to your instance.
代码语言:javascript代码运行次数:0运行复制 user_name@my-instance-ip
I meet Permission denied (publickey)
error.
To fix it.
Step1: Firstly I need to use the previous command to connect to my instance.
代码语言:javascript代码运行次数:0运行复制 -i /path/my-key-pair.pem user_name@ip_address
Step2: Set up a password for the user using passwd command along with the username.
代码语言:javascript代码运行次数:0运行复制sudo passwd ubuntu
Step : Edit d_config file.
代码语言:javascript代码运行次数:0运行复制sudo vim /etc//d_config
Find the Line containing PasswordAuthentication
parameter and change its value from no
to yes
.
PasswordAuthentication yes
If you want to set up root
login, find PermitRootLogin
parameter and change its value from prohibit-password
to yes
PermitRootLogin yes
After this changes save file and exit.
Step 4: Restart the SSH service.
代码语言:javascript代码运行次数:0运行复制service restart ## for ubuntu
service d restart ## for centos
Step 5: Add the .pem file to Local .
代码语言:javascript代码运行次数:0运行复制chmod 400 /path/my-key-pair.pem
-add -k /path/my-key-pair.pem
Step 6: ow you can connect to your instance using a password.
代码语言:javascript代码运行次数:0运行复制 user_name@my-instance-ip
文章作者: Alan Zeng
原始链接: /
版权说明:本博客所有文章除特别声明外,均采用BY-C-SA 4.0许可协议。获得许可后,要求转载时注明文章出处和网站链接,谢谢!
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。 原始发表:2024-08-20,如有侵权请联系 cloudcommunity@tencent 删除awsconnectinstancekey#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格
上传时间: 2025-07-21 20:53:39
推荐阅读
留言与评论(共有 15 条评论) |
本站网友 鳞癣 | 9分钟前 发表 |
the user name is ec2-user. For a CentOS AMI | |
本站网友 宁德二手房 | 27分钟前 发表 |
and the file name extension is .pem. Save the private key file in a safe place.Choose Close.Important | |
本站网友 纹身价钱 | 9分钟前 发表 |
(Optional) Connect to your instance using a passwordOpen a terminal window.Use the following command to connect to your instance. 代码语言:javascript代码运行次数:0运行复制 user_name@my-instance-ipI meet Permission denied (publickey) error.To fix it.Step1 | |
本站网友 避孕套使用方法演示 | 0秒前 发表 |
and then choose Create key pair.Your browser will download the private key file automatically. The private key file is automatically downloaded by your browser. The base file name is the name you specified as the name of your key pair | |
本站网友 农行怎么贷款 | 13分钟前 发表 |
the user name is ec2-user or root. For an Ubuntu AMI | |
本站网友 2月汽车销量 | 15分钟前 发表 |
Connect to your instanceOpen a terminal window.Use the cd command to navigate to the directory where your private key file is located.Use the following command to set the permissi of your private key file so that only you can read it | |
本站网友 郭淑珍 | 6分钟前 发表 |
ow you can connect to your instance using a password.代码语言:javascript代码运行次数:0运行复制 user_name@my-instance-ip 文章作者: Alan Zeng 原始链接: / 版权说明:本博客所有文章除特别声明外 | |
本站网友 icu病房一天多少钱 | 13分钟前 发表 |
the user name is ec2-user. For a CentOS AMI | |
本站网友 永丰房屋出租 | 28分钟前 发表 |
the user name is admin. For a Fedora AMI | |
本站网友 二手苹果笔记本电脑 | 15分钟前 发表 |
代码语言:javascript代码运行次数:0运行复制chmod 400 /path/my-key-pair.pemUse the following command to connect to your instance. Replace ec2-user with the appropriate user name for your AMI.For Amazon Linux 2 or the Amazon Linux AMI | |
本站网友 艾夫斯官网 | 17分钟前 发表 |
Use to connect to AWS EC2 instance 使用连接AWS EC2实例1 | |
本站网友 虎扑f1 | 1分钟前 发表 |
Connect to your instanceOpen a terminal window.Use the cd command to navigate to the directory where your private key file is located.Use the following command to set the permissi of your private key file so that only you can read it | |
本站网友 美国大学雅思要求 | 28分钟前 发表 |
the user name is ubuntu. Here my OS is Ubuntu.Otherwise | |
本站网友 每秒帧数 | 10分钟前 发表 |
(Optional) Connect to your instance using a passwordOpen a terminal window.Use the following command to connect to your instance. 代码语言:javascript代码运行次数:0运行复制 user_name@my-instance-ipI meet Permission denied (publickey) error.To fix it.Step1 |