Score:0

Is user@host at the end of each key in authorized_keys necessary?

kr flag

I have a set of 8 small servers that chat with each other over ssh logging in automatically.

Now I would like to have the .ssh directory of all the servers be identical.

Now my question is whether the user@host part at the end of each key really is necessary?

Score:1
vn flag

No, it's entirely optional. This part of the field is a comment, so it's just an information, usually about where the key originally came from.

It's described here (the best reference I could find):

AuthorizedKeysFile specifies the files containing public keys for public key authentication; if none is specified, the default is ~/.ssh/authorized_keys and ~/.ssh/authorized_keys2 Each line of the file contains one key (empty lines and lines starting with a `#' are ignored as comments). Protocol 1 public keys consist of the following space-separated fields: options, bits, exponent, modulus, comment. Protocol 2 public key consist of: options, keytype, base64-encoded key, comment. The options field is optional; its presence is determined by whether the line starts with a number or not (the options field never starts with a number). The bits, exponent, modulus, and comment fields give the RSA key for protocol version 1; the comment field is not used for anything (but may be convenient for the user to identify the key).

user37342 avatar
kr flag
That is exactly the answer I wanted. Now I can have identical ~/.ssh at least initially on all machines. Thank you.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.