Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在文件末尾使用带有自定义主机名的 ssh-keygen 生成 ssh 公钥。如何在 bash 中本地更改主机名。
只需提供-C标志,文件末尾的内容只是一个注释,除了区分之外没有其他用途。
-C
ssh-keygen -C "somecomment@somehostname"
密钥文件 (id_rsa.pub) 末尾的主机名只是一个注释。您可以使用任何编辑器进行更改。
或者如果您真的想从命令行执行此操作:
awk '{$3 = "myname@myhost.com"; print;}' id_rsa.pub > new_id_rsa.pub