«

Connect to Amazon EC2 Instance from Nautilus without Using Password File

Posted on February 1, 2012
Filed Under Uncategorized | Leave a Comment     

Lately, I have been working frequently with a couple EC2 instances. Remote editing on these instances has become a day-to-day task for me. These instances are based on Amazon Linux. I am so used to the "Ubuntu" way of remote editing, which I have described here. With EC2 instances, however, this method seems to be impossible -- as I need to supply the key file when mounting the remote location via SSH.

For example, if I want to SSH to an EC2 instance, I would do

ssh -i /location_to_the_key_file/xxxxxx.pem ec2-user@ec2-server-ip-or-name

Now I want to connect to the EC2 instance from Nautilus. It will be standard procedure: "File -> Connect to Server -> Type: SSH". But where can I supply the key file information? Once again, after some Googling, I found the solution.

ssh-add /location_to_the_key_file/xxxxxx.pem

After running above command, I am able to mount EC2 instance on my local machine using Nautilus. This time no password is needed. In fact, after this step, I am able SSH to EC2 instance without providing a key file. Hope this will help someone. Enjoy!

Reference

Edit:
Above solution is not permanent. To make the change permanent, create a config under your .ssh directory, and add your key files there. For example,

#~/.ssh/config
IdentityFile ~/.ssh/my-ami-key.pem
IdentityFile ~/.ssh/my-ami-key2.pem

Enjoy!

If you find this post useful, consider donating a few bucks to help the server running cost.

Go to Top

More interesting posts ...

  • No Related Post

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments
If you want to post source code, please wrap it with <pre> </pre>, or it will break.
For quotations, please use <blockquote> </blockquote>

Subscribe to keep track of your comment.

To my beloved readers:
Please note that you may freely post comments here, but I will most likely not be able to reply to most them due to my current availability.

Code Central Special

Categories

Polls

  • Which one do you prefer?

    View Results

    Loading ... Loading ...