How do configure Coda to work for my Amazon EC2 instance?
Asked Answered
L

3

7

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?

Liver answered 3/6, 2011 at 8:34 Comment(0)
I
14

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
Ideation answered 20/6, 2011 at 14:57 Comment(3)
In Coda when you setup your site you need to use somehost.amazonaws.com in the Server field and root in the User Name field unless you want to login as someone else and finally leave password blank.Comb
This was excellent. Thanks. I didn't know that file existed, and it has made my life a lot easier...Danielldaniella
Even with your <name>.pem file in ~/.ssh/ and with permissions set to 700, you may still have trouble with Coda. In current versions of Coda, there is a button adjacent to the password field. Pushing that button invokes a dialog with which you can tell Coda the precise keyfile to use. If you've set Finder to show invisible items (defaults write com.apple.finder AppleShowAllFiles TRUE) followed by (killall Finder), then itNb
T
3

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.

Tonjatonjes answered 4/8, 2012 at 17:56 Comment(1)
I had to use chmod 400 my_key.pem but all the same otherwiseSeurat
G
1

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.

Gynandromorph answered 20/6, 2013 at 23:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.