Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Abu Rayane

macrumors member
Original poster
Sep 23, 2014
49
0
Hello everybody,

I generated a SSH key on my MacBook Pro, then I would like to copy it to an Ubuntu server, using the below command line, it DOES NOT work:

Code:
ssh-copy-id host
-bash: ssh-copy-id: command not found

Thanks in advance
 
I have never heard of 'ssh-copy-id'. Must be a script someone created. Go into your ~/.ssh directory. In there will be the file. Assuming you created an RSA key, the file will be id_rsa.pub. That's the key data you need to transfer to the machine you want to log in to.
 
Should be posted in the OS X forum, not the MacBook Pro one. Anyway ...

cat ~/.ssh/id_rsa.pub | ssh user@ssh_server "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"

If you do not understand what this does, then I suggest further learning before you use command-line for anything else, or else you risk doing some serious damage to your system(s) (not physical damage ... just damage to OS installation that may require (worst case) a reinstall of the OS and/or restore from backup.)
 
Should be posted in the OS X forum, not the MacBook Pro one. Anyway ...

cat ~/.ssh/id_rsa.pub | ssh user@ssh_server "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"

If you do not understand what this does, then I suggest further learning before you use command-line for anything else, or else you risk doing some serious damage to your system(s) (not physical damage ... just damage to OS installation that may require (worst case) a reinstall of the OS and/or restore from backup.)
well, I usually use Ubuntu command line, so I think it is quite similar commands.

Here I am using a different port to connect using SSH, and the folder ssh is already there:
Code:
cat ~/.ssh/id_rsa.pub | ssh 'USER@IP -p PORT' "cat >> ~/.ssh/authorized_keys"
ssh: Could not resolve hostname IP -p PORT: nodename nor servname provided, or not known


----------

I have never heard of 'ssh-copy-id'. Must be a script someone created. Go into your ~/.ssh directory. In there will be the file. Assuming you created an RSA key, the file will be id_rsa.pub. That's the key data you need to transfer to the machine you want to log in to.

I used the Ubuntu command line to copy id

----------

OS X doesn't include ssh-copy-id, but there's an OS X port here: https://github.com/beautifulcode/ssh-copy-id-for-OSX

I haven't tried it but it looks like it should work.

The page failed to open
 
I suggest you ask the IT support of your server for help. The command that duervo has shown you is correct, it only needs some minor tweaks to work for you. If you are not able to figure it out by yourself then you should leave it be until you can learn the basics of unix shell, unless you want to risk messing up your server installation, or your computer, or both.

At any rate, this does not belong on these forums. If you want community help, http://stackexchange.com is a better place.
 
well, I removed the quotes from the syntax and it works:

Code:
cat ~/.ssh/id_rsa.pub | ssh USER@IP -p PORT "cat >> ~/.ssh/authorized_keys"

Thanks for your help
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.