Does known_hosts support comments?

Yes. As the manual page for sshd notes:

Each line in these files contains the following fields: markers (optional), hostnames, bits, exponent, modulus, comment. The fields are separated by spaces.

[…] The optional comment field continues to the end of the line, and is not used.

Lines starting with ‘#’ and empty lines are ignored as comments.

This means that you can create comments in two ways:

# Comments allowed at start of line
closenet,...,192.0.2.53 1024 37 159...93 closenet.example.net

The whole first line is comment and the closenet.example.net is also comment

Leave a Comment