11

I can connect or copy files to EC2 machine via:

ssh -i my.pem ec2-user@ec2.xxx.compute.amazonaws.com

and

scp -i my.pem file.txt ec2-user@ec2.xxx.compute.amazonaws.com:/home/ec2-user

but I want to manage remote files via Midnight Commander. There are "shell links" but how can I use it with key pair connection?

mschayna
  • 213
  • 2
  • 5
  • Related: [Using sftp on non-standard ports with `mc`](https://unix.stackexchange.com/q/29419/209677) – Pablo A May 29 '19 at 16:31

2 Answers2

15

There are "shell links" but how can I use it with key pair connection?

Put the following into ~/.ssh/config:

Host ec2.xxx.compute.amazonaws.com
    User ec2-user
    IdentityFile /path/to/the/my.pem

then try again.

quanta
  • 51,413
  • 19
  • 159
  • 217
  • Excellent! And I can use host alias in `Host` attribute and real host name in `HostName` attribute. Nice. Thanks quanta. – mschayna Sep 18 '12 at 11:43
  • 1
    How is this working again? I'm adding the config file to /.ssh/config and then how will I use it in Midnight Commander? – Softy Feb 17 '15 at 23:53
  • 1
    Totally agree with Softy - then what should I do? I thought that it must detect my.pem file by those settings above for this particular user, when I'll try to connect say - myuser@ec2.xxx.compute.amazonaws.com in Shell Link via mc, err - couldn't chdir. – Arthur Kushman Sep 14 '15 at 12:08
6

Other way. Enter in console:

ssh-add /path/to/your/key/file_name.pem

After that you can enter your_name@your_address.amazonaws.com in mc shell-connect menu and press Ok

El Ruso
  • 165
  • 2
  • 6