4

I was trying to figure out how to add a new SSH key to my amazon server - I found this question and answer

How do you copy the public key to a ssh-server?

However I am so new to Linux/Unix and I overthink things so I thought the following

  1. Since my clients access this server if I mess this up I am going to have serious problems recovering.
  2. How could this possibly work because I have no connection to that other server. I read the first response and it suggests that I could send my newly generated public key to any server in the land.

Does my second point make sense. The command from the shell (which I just installed) reads to me as

  1. ssh - use an ssh session
  2. copy the key to (in my case it would be [email protected] (hosted by Amazon though I am not sure it matters)

In other words - for a totally new user the command suggests that if I use the following command

$ ssh-copy-id [email protected]

if there is actually a user named tim and a server named just.some.other.server

I would then have some privileges at that server

And so I finally tried the command and clearly there is something missing as when I keyed in

$ ssh-copy-id [email protected]

the shell returned

/usr/bin/ssh-copy-id: ERROR: No identities found
PyNEwbie
  • 1,549
  • 3
  • 11
  • 11
  • They don't provide an IP console to use? – Ignacio Vazquez-Abrams Nov 05 '13 at 03:14
  • what is an IP console I apologize for my ignorance however I read your comment and Googled for IP console and got nothing that looked useful – PyNEwbie Nov 05 '13 at 03:29
  • It's one of [these](http://en.wikipedia.org/wiki/System_console) over [this](http://en.wikipedia.org/wiki/World_Wide_Web). – Ignacio Vazquez-Abrams Nov 05 '13 at 03:37
  • @IgnacioVazquez-Abrams No, amazon does not. The only way to recover from access issues in Amazon's EC2 is to shutdown the box, detach the volume, and attach it to another instance. It's actually really easy to do. But still a nuisance. So yeah, don't do anything to lock yourself out :-) – phemmer Nov 05 '13 at 03:48
  • Does this Amazon EC2 doc page help? http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html – rickhg12hs Nov 05 '13 at 03:51
  • Maybe a piece to the puzzle: You usually have your public key served to your VM via [metadata service](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AESDG-chapter-instancedata.html), and grabbed and put into place by something like [cloudinit](https://help.ubuntu.com/community/CloudInit). – sr_ Jun 03 '14 at 07:06

2 Answers2

5
/usr/bin/ssh-copy-id: ERROR: No identities found

This command only works if you have an identity previously created via ssh-keygen.

"Common threads: OpenSSH key management, Part 1"

Ignacio Vazquez-Abrams
  • 44,857
  • 7
  • 93
  • 100
0

First use below command on the source server:

ssh-keygen

Output as below:

Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:

After that use, the ssh-copy-id command, should work.

fra-san
  • 9,931
  • 2
  • 21
  • 42