If you’re unsure how to see your SSH certificates, Jack Wallen strolls you through the steps on Linux, macOS, and Windows.

There will be times when you require to actually see your SSH certificates in Linux. Why? State, for example, you require to include a certificate for authentication in GitHub (or any other online service that requires SSH authentication). You understand you’ve developed those SSH certificates, however how do you view them?

For those who recognize with SSH, you probably already know the answer to that question. After all, this is quite fundamental SSH things. For those who are new to the methods of SSH (or Linux, macOS, or Windows for that matter), the task may stump you.

Never ever fear, that’s why I’m here.

I want to show you just how simple it is to see those SSH secrets, so you can use them for third-party services.

SEE: Identity theft security policy (TechRepublic Premium)

What you’ll need

The only thing you’ll need for this is access to a server or desktop (Linux, macOS, or Windows) and an SSH essential developed. If you have actually not currently created your SSH key pair, you can do so with the command:


That command will create a crucial set, both public and personal secrets. The public key is that which you send out to servers for SSH essential authentication. When you attempt to visit to that server, SSH will compare the general public and private secrets. If those secrets are a match, you’ll be permitted access. Basic enough. You’re all set to move on.

How to view your SSH public key on Linux

There are 2 simple methods to view your SSH public type in Linux. The very first approach is a bit complex, because it makes use of both ssh-agent and ssh-add commands. This is most likely overkill for what you need, however it’s an excellent way to view the secret, while needing your SSH keypair password. The command is:

ssh-agent sh -c ‘ssh-add; ssh-add -L’

Upon effective authentication, your SSH public key will print out in the terminal. You can then copy that and paste it where you need. Of course, that’s a lot of commands to remember, especially when you just need to see the contents of the public secret.

If you do not wish to need to remember yet another command, you could just utilize the feline command thus:

feline ~/. ssh/id _ rsa.pub

The above command will print out your SSH key on your Linux maker, without triggering you for your key authentication password.

How to see your SSH public key on macOS

Viewing your keys on macOS can be done in similar fashion as Linux. Open your terminal window and issue the command:

feline ~/. ssh/id _ rsa.pub


cat/ Users/USERNAME/. ssh/id _ rsa.pub

Where USERNAME is your macOS username.

The above commands will print out your SSH public secret.

macOS also has another awesome trick up its sleeve. You can copy the contents of the SSH secret directly to the clipboard, without displaying the secret, using the pbcopy tool. This command would be:

feline ~/. ssh/id _ rsa.pub|pbcopy

As soon as you’ve copied the key to your clipboard, you can paste it any place you require it.

How to view your SSH public key on Windows

On Windows, you’ll utilize the type command to see your SSH public key thus:

type C: Users USERNAME . ssh id_rsa. bar

Where USERNAME is the name of your user.

The above command will display your SSH public key. You can then utilize the Ctrl+c keyboard shortcut to copy the contents of the file.

You can likewise do something comparable to what we did on macOS (copying the SSH public key directly to the clipboard) using the type and clip commands thus:

type C: Users USERNAME . ssh id_rsa. bar|clip

Where USERNAME is your username.

You can now paste that essential wherever you require it.

How to see your private key

Chances are you’re not ever going to need to see your personal key. After all, that’s the trick in the sauce that’s never ever on display screen for anyone to see. But, on the off possibility you do need to view that secret, you can follow the exact same actions as above, but eliminate the.pub from the file name (in any instance). Keep in mind id_rsa is the private key and id_rsa. pub is the public key.

Which’s all there is to seeing your SSH public and personal secrets on Linux, macOS, and Windows.

Just remember, deal with these secrets with the care and security they are worthy of. Although your public secret will be handed out to other users and services, that private key requirements to be stashed and never revealed to the public. If you do accidentally launch that personal key, you’ll need to get rid of the general public secret from the authorized_keys file from every server that utilizes the keypair, erase the public and private secrets on the host, generate a new keypair, and send it to the servers you require to log in to with SSH key authentication. If you leave any trace of that jeopardized crucial set on any server or desktop, you run the risk of permitting somebody gain access to.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the current tech guidance for company pros from Jack Wallen.

Cybersecurity Insider Newsletter Strengthen your company’s IT security defenses by keeping up with the most recent cybersecurity news, services, and best practices. Delivered Tuesdays and Thursdays

Register today

Also see

Image: iStock/Stock Depot