ssh-copy-id 究竟是做什么的? [英] What, exactly, does ssh-copy-id do?

查看:23
本文介绍了ssh-copy-id 究竟是做什么的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ssh-copy-id 命令的作用是什么?我已经使用它很多次了,而且效果很好.但是,当我尝试手动剪切我的 .pub 密钥文件并将其粘贴到我的远程授权密钥时,它不起作用.

What does the ssh-copy-id command do, exactly? I've used it numerous times and it works great. However, when I try to manually cut and paste my .pub keyfile to my remote authorized_keys, it doesn't work.

我比较了我将 .pub 剪切并粘贴到其中的 authorized_keys 文件的内容与随后使用 ssh-copy-id 的内容,我没有发现两者之间有任何区别,包括空格.

I've compared the contents of my authorized_keys file where I've cut and pasted the .pub into it vs subsequently using ssh-copy-id and I'm not seeing any differences between the two, including whitespace.

ssh-copy-id 除了将公钥复制到authorized_keys 之外还有什么作用吗?

Is there anything that ssh-copy-id does beyond copying the public key into authorized_keys?

推荐答案

这个小命令真的应该有效.每次没有 ssh-copy-id 时我都会使用它,例如当我在 Mac 上时.

This little command really should work. I use it every time there is no ssh-copy-id, for example when I'm on Mac.

cat ~/.ssh/id_rsa.pub | ssh <user>@<hostname> 'cat >> ~/.ssh/authorized_keys'

IMO 这比手动复制和粘贴要好:在这种情况下,您确切地知道文件中的最终内容

IMO It's better than manual copy and paste: in this case you know exactly what content will end up in the file

这篇关于ssh-copy-id 究竟是做什么的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆