大网数据广告活动
服务器运维问答

What significance does the user/host at the end of an SSH public key file hold?

· 52CE 我爱测

I can’t figure out why does an SSH public key file generated by ssh-keygen have a user and host at the end of it. Example: id_rsa.pub ssh-rsa ... rest of file ... /CA9gyE8HRhNMG6ZDwyhPBbDfX root@mydomain Notice the root@mydomain …

问题原文

原帖链接 · Basil A · CC BY-SA 3.0

I can’t figure out why does an SSH public key file generated by ssh-keygen have a user and host at the end of it.

Example: id_rsa.pub

ssh-rsa ... rest of file ... /CA9gyE8HRhNMG6ZDwyhPBbDfX root@mydomain

Notice the root@mydomain at the end of the file.

If I can use the public key anywhere with any user to authenticate using my private key, what significance does the root@mydomain have on the authentication process?

Or is it just a place holder to figure our who was it issued by?

已采纳解答

原帖链接 · Michael Hampton · CC BY-SA 4.0

This field is a comment, and can be changed or ignored at will. It is set to user@host by default by ssh-keygen.

The OpenSSH sshd(8) man page describes the format of a public key thus:

Public keys consist of the following space-separated fields: options, keytype, base64-encoded key, comment. . . . The comment field is not used for anything (but may be convenient for the user to identify the key).

The ssh-keygen(1) man page says:

The key comment may be useful to help identify the key. The comment is initialized to “user@host” when the key is created, but can be changed using the -c option.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-12-16)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。