如何在Mac上安装ssh-copy-id?


Answers:


344

您可以使用Homebrew安装它:

brew install ssh-copy-id

如果您不想使用Homebrew,可以使用以下Mac端口

curl -L https://raw.githubusercontent.com/beautifulcode/ssh-copy-id-for-OSX/master/install.sh | sh 

首先给我带来了错误,但事实证明,我的Brew库有点过期了。运行brew update然后再次安装解决了该问题。
拉普兰科汉


7

ssh-copy-id 现在默认情况下已在macOS上安装。

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.12.4

$ which ssh-copy-id
/usr/bin/ssh-copy-id

5

以上方法在旧Mac上不起作用。我有一个狮子操作系统。请改用此命令,因为由于ssl上的编译依赖性错误,ssh-copy-id无法与brew安装在旧PC上。

cat ~/.ssh/id_rsa.pub | ssh user@123.45.56.78 "mkdir -p ~/.ssh && cat >>  ~/.ssh/authorized_keys"

信用去这个网站


chmod 700从链接的网站上删除了。您可以改为使用: ssh USER@HOST 'umask 077 && mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys'
jrw32982支持Monica

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.