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.
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!
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,