https://github.com/tie/pubkey
Extract public key from SSH private key
https://github.com/tie/pubkey
ssh ssh-key
Last synced: 6 months ago
JSON representation
Extract public key from SSH private key
- Host: GitHub
- URL: https://github.com/tie/pubkey
- Owner: tie
- License: unlicense
- Created: 2019-08-08T14:17:34.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-08T15:45:31.000Z (almost 7 years ago)
- Last Synced: 2024-06-20T10:09:18.690Z (about 2 years ago)
- Topics: ssh, ssh-key
- Language: Go
- Size: 1.95 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pubkey
Extract public key from SSH private key.
---
Let’s suppose that you’ve accidentally `rm`’ed your `~/.ssh/id_ed25519.pub` file.
Don‘t panic, ssh would still work because private key file contains public key.
And if you need to recover `.pub` file, you’ve found the right tool.
## Usage
All flags are optional. The input file `-f` flag defaults to `$HOME/.ssh/id_rsa`, or `/etc/ssh/ssh_host_rsa_key`
if `$HOME` is not set. Empty input file path implies standard input. The public key is written to standard output
if output file flag `-o` is not specified. Chmod-style permissions for output file may be specified using `-c` flag.
- Write the public key of `id_ed25519` identity to the `id_ed25519.pub` file.
```
pubkey -f ~/.ssh/id_ed25519 -o ~/.ssh/id_ed25519.pub -c u=r,g=r
```
- You can also pipe your private key through `cat` without exposing file descriptors to `pubkey`.
```
< ~/.ssh/id_ed25519 cat | pubkey -f= | cat > ~/.ssh/id_ed25519.pub
```