views:

272

answers:

2

I ran ssh-keygen on OS X and when I displayed the public key generated, I saw that my login and machine name appears in the last part of the key. Is there any way to have it use a different value or not use it at all?

+1  A: 

Yes! It isn't needed at all, it's just arbitrarily appended to make it easy for you to remember where it came from. If you want to edit it, just open a Terminal session and type:

$ nano ~/.ssh/id_rsa.pub

Remove the end part of the line (after the double-equals).

Aupajo
+3  A: 

From the manpage for ‘ssh-keygen(1)’:

For RSA1 keys, there is also a comment field in the key file that is only for 
convenience to the user to help identify the key.  The comment can tell what the 
key is for, or whatever is useful.  The comment is initialized to “user@host” 
when the key is created, but can be changed using the -c option.
…
-C comment
        Provides a new comment.

-c      Requests changing the comment in the private and public key files.  This 
        operation is only supported for RSA1 keys.  The program will prompt for 
        the file containing the private keys, for the passphrase if the key has 
        one, and for the new comment.

So, you should be able to use -C "$desiredcommenttext" to provide whatever desired comment text you like when creating the key; or use the -c option to change the comment on an existing key.

bignose