I would like to generate an ssh key pair for a service account on one machine to access another machine via ssh.

When I generate the key with my user, my username is embedded in the public key. E.g. This has [email protected] in the public key

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDHt9bVJZZ78NE8xYXDfPyXE4+1ajONSRzBAW7WCRPWj4oc2X7dm1usZQIq9kca0b8IaFXtiMdUoCtkqGQz9Jd8/7zHkM5Fo+SR1NvsK8TNPlHkHQzlLxvn9OAjfKfDwjUCc7OskVxYwDpsWK6s0E0cRGJhI4Ccaws5EV6sgveuPJ1Bi/lmnz1CUKgsxlqHza0EH4eiCx5fb+k1lF71+o7urKiG2TUmCOEocwmjJ6WieDE+MrNSmPtOUD8Oo01QF9/PttdE3VsUATYgB/GhWmENH/o7hdyckq6fnUmpAaomOPeiCbw5pOHiadhDwiGH7gU/GfAugmFrrfv6sb1hkM980ufB7uvShpaMYa4eLiaAN+TIvmvpodkDeS5NMLPzcRN+cnAsflZa8pb2VeXmVWTIc2buYoWzI7Mc1iuQbnQwJh8WbjruDvgUCHNaR+GBDpOh17Qq/AR1ew+J8wo3a6foyxFHWji9gj4dlSuaZfyTfBdiBo6Xux0iyQrzDL9QTTc= [email protected]

NOTE: You cannot log on as the service account to generate the key - hence I need to generate it from my login.

Is there a way to generate the key from my login, but the generated key have the service account name.

1 Answer 1


In ssh speak, that's a comment, not a name. But I find "name" more fitting, as that's exactly what it's used for... so.

  1. you can just change the name, arbitrarily, using ssh-keygen -c. Not part of the key itself.
  2. you can specify the "name" with the -C command line option to ssh-keygen.

For future readers / reference: Had you known to look for "comment", you'd have found this info in man ssh-keygen.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .