且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Mac上通过SSH连接到Amazon AWS Linux服务器

更新时间:2023-01-20 07:51:14

您需要将密钥对放入{您的主目录}/.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>