Search code examples
ubuntusshamazon-ec2nautilussshfs

Ssh(sftp) with certificate via Nautilus in Ubuntu 10.10


Before I connected to my server via Nautilus (sftp). Now I moved to Amazon EC2, and there's just one way connect to server (ubuntu 10.10 too), using ssh -i mycert.pem, no password, just certificate. How can I connect to the server using Nautilus, just like i did before? In other way I guess I can disable certificate by making some changes in /etc/ssh/ssh_config,but not sure what to do.

UPD: Finally i found solution by using sshfs, more explanation here How to mount Amazon ec2 drive locally - fuse + sshfs?

and googling by keywords sshfs + amazon ec2

UPD2:

ssh-add /path/to/my_cert.pem

and after this connection to sftp via nautilus also working fine


Solution

  • I don't quite know what you mean by "I guess I can disable certificate" when you just said "and there's just one way connect [...] just certificate"?

    I guess you'd like to have something more like this in .ssh/config. Append a section like the following 5 lines to any existing ~/.ssh/config (i.e. /home/sehe/.ssh/config)

    Host myec2host
    HostName 151.47.12.88
    User ubuntu
    IdentityFile ~/.ssh/mycert.pem
    Compression yes
    

    Note

    1. Replace myec2host by the alias that you want to access the ec2 instance by
    2. Replace the IP address by the external (optionally elastic) IP address of your instance
    3. Replace ~/.ssh/mycert.pem by the full path to your private key (usually the keypair) you registered the instance with; I copied the name mycert.pem from your own question, so it is probably that file
    4. Any other options (like Compression) are optional. By default, Ubuntu images on ec2 (especially the ones from Canonical) should be logged onto using user ubuntu; root won't work

    Of course man ssh_config will do miracles for the details. Also, http://alestic.com/ is an excellent resource on Ubuntu+EC2 (just make sure you don't confuse the Alestic and Canonical images). Lastly there is the google group for ec2ubuntu which has been very helpful to starters.


    This way you can just point Nautilus at the server 'my3c2host' and get the reset for free. If the key is protected with a passphrase, you can use a passphrase agent (seahorse, gpg-agent... dunno by heart)