# The Ubuntu Forum Community > Ubuntu Specialised Support > Security > [ubuntu] SSH: How to generate public key from private key?

## Westerberg

According to this thread, I should be able to generate a public key to match a private key I already have:




> If you didn't notice, it generated another public key.This is the same key as is on your computer, as you can always generate your public key from your private key (but not the other way around).


The author used something called puttygen.exe, which I assume is a windows program.  How would I do in Ubuntu what he did?

----------


## kevdog

Probably someone will beat me to this, but can I clarify one thing?  Do you want to generate putty keys or openssh keys?  The two are not interchangeable.  They both work with ssh, but you can't for example use putty private and openssh public keys together.  What client are you going to use to complete the ssh connection?

----------


## Westerberg

Nevermind.  I think I figured it out.  It's:


```
ssh-keygen -e
```

----------


## kevdog

ssh-keygen -e -- This would imply open-ssh keys and not putty keys -- just an FYI

----------


## MountainX

> Nevermind.  I think I figured it out.  It's:
> 
> 
> ```
> ssh-keygen -e
> ```


I don't think that's the option you want. (I realize the question is old, so this comment is really for new people seeing the question.)

The correct option would be 


```
ssh-keygen -y
```

----------

