我在尝试在我的Mac上安装ssh-copy-id时遇到了麻烦。我尝试按照https://github.com/beautifulcode/ssh-copy-id-for-OSX的步骤进行,但每次运行ssh-copy-id都会出现错误。有什么想法可以让ssh-copy-id成功安装吗?
我在尝试在我的Mac上安装ssh-copy-id时遇到了麻烦。我尝试按照https://github.com/beautifulcode/ssh-copy-id-for-OSX的步骤进行,但每次运行ssh-copy-id都会出现错误。有什么想法可以让ssh-copy-id成功安装吗?
您可以使用Homebrew进行安装:
brew install ssh-copy-id
如果您不想使用Homebrew,您可以使用这个Mac端口: this Mac port:curl -L https://raw.githubusercontent.com/beautifulcode/ssh-copy-id-for-OSX/master/install.sh | sh
brew update
然后再次安装解决了问题。 - LapplandsCohanMacPorts版本:sudo port install openssh +ssh-copy-id
ssh-copy-id
现在默认已经安装在macOS上了。
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.12.4
$ which ssh-copy-id
/usr/bin/ssh-copy-id
以上方法不适用于旧版的 Mac。我有一台 Lion 操作系统的电脑,因为旧版电脑上使用 brew 安装 ssh-copy-id 会出现编译依赖错误导致无法安装,所以可以尝试使用以下方法:
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'
。 - jrw32982cat ~/.ssh/id_rsa_name.pub | ssh <username>@192.168.1.X "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys"
- 这在我的旧 Mac - El Capitan 上运行良好。 - Manuel Jordan