在Mac上通过SSH连接到Amazon AWS Linux服务器 [英] connecting to amazon aws linux server by ssh on mac

查看:243
本文介绍了在Mac上通过SSH连接到Amazon AWS Linux服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个新的密钥对并将其下载到我的mac,然后使用该密钥对和我的安全组来设置新的Amazon Linux AMI服务器.现在,我需要将下载的密钥对.pem文件放在用户文件夹中的.ssh文件中?由于名称原因,我无法创建一个名为".ssh"的文件夹.

I created a new keypair and downloaded it to my mac, then set up a new Amazon Linux AMI server with that keypair and my security group. Now I need to put the keypair .pem file that I downloaded in a .ssh file in my users folder? I am unable to create a folder called ".ssh" however because of the name.

我在哪里将密钥对放在Mac上?然后从我的linux bash连接到服务器需要什么chmods或其他命令?我知道"ssh我的公共DNS",但是我应该知道其他哪些权限或其他事项?这是一个新手问题.谢谢.

Where do I put the keypair on my mac? and what chmods or other commands are then needed to connect to the server from my linux bash? I know "ssh my public DNS" but what other permissions or anything else should I be aware of? Its a newbie question. Thanks.

推荐答案

您需要将密钥对放入{您的主目录}/.ssh中.如果该文件夹不存在,请创建它.将密钥对放入其中后,您必须更改文件的权限,以便只有您的用户才能读取它. 启动终端,然后输入

You'll want to put the keypair in {your home directory}/.ssh . If that folder doesn't exist, create it. Once you put the keypair in there you have to change the permissions on the file so only your user can read it. Launch the terminal and type

chmod 600 $HOME/.ssh/<your keypair file>

这将限制对文件的访问,然后再限制对文件夹类型的访问

That limits access to the file, and then to limit access to the folder type

chmod 700 $HOME/.ssh

您必须限制访问权限,因为OpenSSH协议不允许您使用其他人可以查看的密钥.

You have to limit the access because the OpenSSH protocol won't let you use a key that other's can view.

然后从您要输入的终端登录您的实例

Then to log into your instance, from the terminal you would enter

ssh -i <your home directory>/.ssh/<your keypair file> ec2-user@<ec2 hostname>

这篇关于在Mac上通过SSH连接到Amazon AWS Linux服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆