linuxubuntusshrsassh-keys

ssh-keygen - how to set an rsa key with a certain username


I just installed ubuntu and would like to set its rsa keys up with bitbucket/github. When I ssh-keygen the keys are generated as they should be

ssh-rsa AA...yBEz3pLL georgemauer@ubuntu

which is perfectly usable except the username part. In every rsa key I've generated previously, the username section read my email address:

ssh-rsa AA...yBEz3pLL gmylastname@gmail.com

No, it's not a major impediment but if I don't get this right it will drive me crazy. How, do I generate with rsa keys with an email username of my choice?


Solution

  • Use the -C option to provide a new comment with your key. Here is a sample:

    ssh-keygen -t rsa -b 4096 -C "gmylastname@gmail.com" -f ./my-ssh.key