sshlocalhostremote-host

ssh to single host from multiple users


I have already successfully set up an automatic ssh connection to a remote host on my (Mac) laptop (ssh-keygen, ssh-copy-id of the public key on the .ssh folder on the host machine, inserted the password once and now connects automatically). I would like to be able to do the same from the (Ubuntun 12) machine I use at work. Here's what I did: used ssh-keygen again, this time calling the keys id_rsa2 (differently from my laptop's which is the standard id_rsa) and here come's the problem: if I try to ssh-copy-id -i ~/.ssh/id_rsa2.pub user@hostname:/.ssh/ I get:

ssh: Could not resolve hostname hostename:/.ssh: Name or service not known 

but if I try to ssh user@hostmane, I am prompted to insert the password and it connects without problems. Any clue someone? thank you very much


Solution

  • You should drop the :/.ssh/ from the end of your hostname:

    ssh-copy-id -i ~/.ssh/id_rsa2.pub user@hostname