I am having trouble trying to install ssh-copy-id on my Mac. I have tried to follow https://github.com/beautifulcode/ssh-copy-id-for-OSX but every time I run ssh-copy-id it gives me errors. Any ideas on how to get ssh-copy-id to install?
You can install it using Homebrew:
brew install ssh-copy-id
If you don't want to use Homebrew, you can use this Mac port:
curl -L https://raw.githubusercontent.com/beautifulcode/ssh-copy-id-for-OSX/master/install.sh | sh
-
First gave me errors, but it turned out my brew library was a bit overdue for a refresh. Running
brew update
and then installing again solved the problem. – LapplandsCohan Sep 29 '16 at 18:30
ssh-copy-id
is installed on macOS by default now.
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.12.4
$ which ssh-copy-id
/usr/bin/ssh-copy-id
The above methods do not work on old Macs. I have a lion OS. use this instead because the ssh-copy-id can not be installed with brew on old PCs due to compiling dependencies errors at ssl.
cat ~/.ssh/id_rsa.pub | ssh user@123.45.56.78 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
credit goes to this site
-
You left out the
chmod 700
from your linked site. You could instead use:ssh USER@HOST 'umask 077 && mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys'
– jrw32982 Jun 1 '20 at 20:46