97
votes
Accepted
How to get a .pem file from ssh key pair?
According to this, this command can be used:
ssh-keygen -f id_rsa -e -m pem
This will convert your public key to an OpenSSL compatible format.
Your private key is already in PEM format and can be ...
- 9,511
74
votes
Add comment to existing SSH public key
Just start the line with a # sign, then the whole line will be treated as a comment
See the man page of authorized_keys
- 928
54
votes
How to get a .pem file from ssh key pair?
Using ssh-keygen to export the key in the .pem format worked for me.
ssh-keygen -f id_rsa.pub -m 'PEM' -e > id_rsa.pub.pem
Then simply copy the .pem key as necessary.
Options as follows: (See man ...
- 2,751
32
votes
Accepted
Why should I use Public-Key Authentication for SSH?
if someone hacks into my computer, he doesn't just get my computer, but my server too?
This is potentially true anyway with keyloggers: as soon as you log into your server from the compromised ...
- 1,720
21
votes
Accepted
ssh command line specify server host key fingerprint
There's no command-line option in OpenSSH to pass a host key fingerprint.
Though you can use a temporary file (with the same format as the known_hosts) and make the ssh use that using the -o ...
- 7,544
18
votes
How to get a .pem file from ssh key pair?
Initially, when using ssh-keygen, I could generate a public key that was compatible with AWS EC2, but had issues with creating private keys that were compatible. The following creates both public and ...
14
votes
ssh how to allow a very limited user with no home to login with pubkey
diya has already explained that you could change to AuthorizedKeysCommand for retrieving the public key of a user.
However, it's probably easier for you to place the authorized_keys file somewhere ...
- 767
13
votes
Is it possible to use a gpg public key to encrypt a message without importing the key?
GnuPG requires all keys you want to use to be imported into a keyring.
If you don't want to import it to your normal keyring, either use another (temporary) keyring, or even a temporary GnuPG home ...
- 1,500
12
votes
Disable the public key check for rpm installation
For legacy RPM Linux without yum use:
rpm -i --nosignature
- 571
12
votes
SSH Public Key Format
This is the complete, correct answer:
ssh-keygen -i -m PKCS8 -f public-key.pem
- 247
12
votes
How to export private key? (GnuPG)
Hint 1: gpg calls private keys 'secret' because PGP dates from before people settled on the names 'private' key for the half of an asymmetric pair held by (ideally) only one party versus 'secret' key ...
- 3,210
12
votes
Accepted
Can I use Public-Key-Pins with LetsEncrypt?
Some words of caution to begin with:
Know what you're doing, if you're planing to implement HPKP.
If you don't do it right, or "if bad things happen", which aren't under your control, you might ...
- 5,541
12
votes
Why should I use Public-Key Authentication for SSH?
If you are using good passwords, this can be secure enough. I usually limit the number of publicly accessible servers to the minimum and allow SSH from specific IP(s) whenever possible.
Also, you can ...
- 36.2k
12
votes
Why should I use Public-Key Authentication for SSH?
One way where public-key authorization is more secure is when the attacker manages to be man-in-the-middle (MitM) between your client computer and the server, and you don't notice the changing host ...
- 253
11
votes
Accepted
How can I get sshd to tell me why it's failing public key authentications?
On the server side, set the log level to DEBUG3. On the client side, connect with the -vvv option (which gives you DEBUG3 on the client side as well).
- 1,531
11
votes
Can I use Public-Key-Pins with LetsEncrypt?
Would echo everything that gf_ said.
However, to answer the question, yes you can.
By default Let's Encrypt recreates the key and the cert at renewal. This makes implementing HPKP difficult if you ...
- 4,541
10
votes
PEM File "CERTIFICATE" vs "PUBLIC KEY"
One is a public cert, the other is a key. As Federico stated in comments, this question addresses it pretty well.
That being said, what are you trying to do?
- 2,627
10
votes
ssh how to allow a very limited user with no home to login with pubkey
The alternative to a file with public keys is the openssh server directive AuthorizedKeysCommand which allows you to configure your sshd daemon to run a specific helper program to retrieve the public ...
- 1,713
8
votes
Create a public SSH key from the private key?
Solution is specifically for users using Windows
Tool Used:
Puttygen (PuTTY Key Generator)
WinSCP
Steps to perform:
Open PuTTY Key Generator.
Load your private key (*.ppk file).
Copy your public ...
- 181
7
votes
Accepted
How to convert DER formatted public key file to PEM form
You should add -pubin for public key inputs.
openssl rsa -pubin -in user_id_rsa.pub -inform DER -outform PEM -out pubkey.pem
EDIT: To handle PEM RSA PUBLIC KEY format, specify -RSAPublicKey_in -...
- 821
7
votes
Accepted
Why won't my SSH keys forward properly?
If you want to forward connection to your authentication agent, you need to have the authentication agent running on your machine. You can check it using ssh-add -l. If it is not running, start it and ...
- 9,465
6
votes
Accepted
Adding new user to AWS EC2 - Permission denied (publickey)
You can login to EC2 instance with the same access key you use for default user. Suppose, you are running Ubuntu and default username is ubuntu. Then your public key is located in /home/ubuntu/.ssh/...
- 2,893
5
votes
Debian. How can I securely get debian-archive-keyring, so that I can do an apt-get update? NO_PUBKEY
Debian - Apt-get : NO_PUBKEY / GPG error
In computers based on a Debian operating system that uses Linux kernel, error messages may come up like 'NO_PUBKEY'.This happens while using the Apt-Get ...
- 577
5
votes
Can I use Public-Key-Pins with LetsEncrypt?
I just implemented this using the dehydrated client with dns01 validation. The dns01 hook is certzure because our DNS is hosted in Azure.
Edit: when I talk about private keys, obviously I always mean ...
- 880
5
votes
Public Key Authentication not work on Windows 10 Professional
Use this sequence of commands in PowerShell to correct permission of administrators_authorized_keys
$acl = Get-Acl C:\ProgramData\ssh\administrators_authorized_keys
$acl.SetAccessRuleProtection($true, ...
- 171
4
votes
Accepted
How many SSH private key to setup for multiple servers?
The general answer is that you likely will want to put the same personal public key on all servers/accounts you want to login in on. For all practical purposes it's more or less impossible to derive ...
- 6,878
4
votes
Accepted
Is it possible to use a gpg public key to encrypt a message without importing the key?
You could make a small shell script that copies your pubring.gpg file, imports the key, encrypts your file, then moves your original pubring.gpg file back into place. This turns it into a one-liner ...
- 821
4
votes
Accepted
Permission denied (publickey) for my AWS EC2 instance from another computer
Change your file permission to 400 (chmod 400 dymmy.pem) . The message clearly says that the file permissions are too open.
- 56
4
votes
Accepted
What is the good practice for adding known keys/fingerprints to known_hosts
Having a public key, you can simply write the key into the known_hosts file and possibly re-hash, if you need to:
HOSTNAME=my.awesome.host
PORT=7999
PUBKEY="ssh-rsa AAAAB3NzaC1yc2EAAAAD...E"
...
- 9,465
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
public-key × 279ssh × 206
ssh-keys × 44
authentication × 41
private-key × 32
linux × 30
amazon-ec2 × 23
rsa × 18
ubuntu × 15
centos × 14
amazon-web-services × 14
git × 13
password × 12
debian × 11
ssl-certificate × 10
ssl × 9
gpg × 9
security × 7
permissions × 7
sftp × 7
putty × 7
openssl × 6
ssh-keygen × 6
certificate × 5
encryption × 5