Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

What Goes Into an SSH Public Key?

What Goes Into an SSH Public Key?

What Goes Into an SSH Public Key?

Ok, my Google Fu has failed me. I can't find the answer to this one on the web. I turn to Tek-Tips seeking an answer.

The question came up here at work, what goes into the creation of an SSH public key? IP? Hostname? Hostid? Something else?

That is, if I create a public key on one machine, say with an IP address of, but then the machine crashes and burns and we bring in fresh hardware, fresh OS install, but it's set up with the same IP address, will my old public key still work? That is assuming that I've restored my matching private key from backup.

In other words, is the only thing that needs to match are a ssh-keygen generated private and public key pair? Or, does a changing IP affect it? Other system changes?

The background on this is that when creating an Amazon EC2 instance, you get an ephemeral IP address that can change when you create an instance. We're trying to pre-share SSH keys to automate certain set-up things, but we're having trouble getting a key to work. Just wondering what goes into creating the public key to try to find a solution.

RE: What Goes Into an SSH Public Key?

I don't know what goes into making up the key, but I do know it can be restored and it will work.

It can also be copied to other machines and/or users, and still work.

The private rsa key would be called (by default) id_rsa. You can actually copy that file to another user on another machine, and they would be able to ssh to any account on any machine that has the public key side of the pair of files installed (id_rsa.pub). That's why it's pretty essential that private keys are protected.

So, it's mostly just that the pair of key files match each other, public and private, rather than the actual machines or user ids you are coming from or going to. That's why it's critical for security to protect private keys.

This is pretty easy to test if you have a couple test machines.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close