如何配置 Coda 以适用于我的 Amazon EC2 实例?

发布于 2024-11-11 18:06:03 字数 94 浏览 9 评论 0原文

我无法连接到我的 EC2 实例。我已在 AWS 控制台中打开端口 21。我认为在 Coda 中无法输入我的 SSH 密钥对。有没有办法将 Coda 连接到我的 EC2 实例?

I can not connect to my EC2 instane. I have opened port 21 in the AWS Console. I think there is no way of input my SSH Key pair in Coda. Is there a way of connecting Coda to my EC2 instance?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

眼眸里的快感 2024-11-18 18:06:03

Coda 应该从您的 ssh 配置中获取设置,以便您可以相当轻松地进行配置。

如果您已将 EC2 ssh 密钥对保存在 ~/.ssh/ec2_rsa 中,则只需编辑 ~/.ssh/config 即可:

IdentityFile ~/.ssh/ec2_rsa

您还可以将 IdentityFile 指令限制为仅您的 AWS 资源:

Host somehost.amazonaws.com
    IdentityFile ~/.ssh/ec2_rsa

如果一切配置正确,那么您应该能够从命令行运行 ssh username@awshost 并获取登录提示

如果您仍然遇到问题,您可以随时通过编辑 /etc/ssh 在实例上启用密码身份验证/sshd_config 并将行 PasswordAuthentication yes 添加到文件末尾,然后使用 passwd 为您的用户设置密码

我在我的 . ssh/config 自动将我的 EC2 密钥对应用于 EC2 资源:

# EC2 Northern Virginia
Host *.compute-1.amazonaws.com
    IdentityFile ~/.keys/ssh/ec2/us_east_1.key
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
    IdentitiesOnly yes
    ForwardAgent no

# EC2 Northern California:
Host *.us-west-1.compute.amazonaws.com
    IdentityFile ~/.keys/ssh/ec2/us_west_1.key
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
    IdentitiesOnly yes
    ForwardAgent no

# EC2 Ireland:
Host *.eu-west-1.compute.amazonaws.com
    IdentityFile ~/.keys/ssh/ec2/eu_west_1.key
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
    IdentitiesOnly yes
    ForwardAgent no

# EC2 Singapore:
Host *.ap-southeast-1.compute.amazonaws.com
    IdentityFile ~/.keys/ssh/ec2/ap_southeast_1.key
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
    IdentitiesOnly yes
    ForwardAgent no

# EC2 Tokyo:
Host *.ap-northeast-1.compute.amazonaws.com
    IdentityFile ~/.keys/ssh/ec2/ap_northeast_1.key
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
    IdentitiesOnly yes
    ForwardAgent no

Coda should pick up settings from your ssh config so you can configure this fairly easily.

If you've saved your EC2 ssh keypair in ~/.ssh/ec2_rsa then simply edit ~/.ssh/config to look like:

IdentityFile ~/.ssh/ec2_rsa

You can also restrict the IdentityFile directive to just your AWS resource with:

Host somehost.amazonaws.com
    IdentityFile ~/.ssh/ec2_rsa

If everything's configured properly then you should be able to, from the command line, run ssh username@awshost and get a login prompt

If you continue to have problems you can always enable password authentication on your instance by editing /etc/ssh/sshd_config and adding the line PasswordAuthentication yes to the end of the file, then setting a password for your user with passwd

I use the following settings in my .ssh/config to automatically apply my EC2 keypairs for EC2 resources:

# EC2 Northern Virginia
Host *.compute-1.amazonaws.com
    IdentityFile ~/.keys/ssh/ec2/us_east_1.key
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
    IdentitiesOnly yes
    ForwardAgent no

# EC2 Northern California:
Host *.us-west-1.compute.amazonaws.com
    IdentityFile ~/.keys/ssh/ec2/us_west_1.key
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
    IdentitiesOnly yes
    ForwardAgent no

# EC2 Ireland:
Host *.eu-west-1.compute.amazonaws.com
    IdentityFile ~/.keys/ssh/ec2/eu_west_1.key
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
    IdentitiesOnly yes
    ForwardAgent no

# EC2 Singapore:
Host *.ap-southeast-1.compute.amazonaws.com
    IdentityFile ~/.keys/ssh/ec2/ap_southeast_1.key
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
    IdentitiesOnly yes
    ForwardAgent no

# EC2 Tokyo:
Host *.ap-northeast-1.compute.amazonaws.com
    IdentityFile ~/.keys/ssh/ec2/ap_northeast_1.key
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
    IdentitiesOnly yes
    ForwardAgent no
清晨说晚安 2024-11-18 18:06:03

我为此苦苦挣扎了一段时间,因此为我分享重要的步骤:

  1. 在 /.ssh/config 中配置别名
  2. 确保 my_key.pem 的权限有意义,例如。做> chmod 644 my_key.pem
  3. 在创建 SSH 或 SFTP 会话时,只需将您的别名放入服务器字段即可,仅此而已。

这对我有用。

I struggled with this for some time, so sharing important steps for me:

  1. Configure an alias in /.ssh/config
  2. Make sure permissions of my_key.pem makes sense, eg. do > chmod 644 my_key.pem
  3. Simply put your alias in Server field when creating SSH or SFTP session, and nothing else.

That worked for me.

梦年海沫深 2024-11-18 18:06:03

在新版本的 Coda 中,右侧的密码框中会显示一个小钥匙图标。如果单击此按钮,您可以浏览到 PEM 文件并选择它作为您的密码。

一旦您单击密码框,该图标就会消失,据我所知,如果不创建新项目,您就无法恢复它。

In the new version of Coda, there's a small icon of a key which shows up inside the password box on the right. If you click this, you can browse to the PEM file and choose that as your password.

The icon disappears once you click the password box, and as far as I can tell you can't get it back without making a new project.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文