Questions tagged [ssh-keygen]
The ssh-keygen tag has no usage guidance.
89
questions
105
votes
3
answers
45k
views
What's the purpose of the randomart image for user (not host) SSH keys?
The ssh-keygen generates the following output:
The key fingerprint is:
dd:e7:25:b3:e2:5b:d9:f0:25:28:9d:50:a2:c9:44:97 user@machine
The key's randomart image is:
+--[ RSA 2048]----+
| .o o.. ...
42
votes
1
answer
4k
views
Why do portions of SSH public (and private) keys overlap?
Specifically, why are the first 25 characters of ssh Ed25519 public keys always the same?
For example, if I make 5 keys with ssh-keygen -o -a 100 -t ed25519, the first 25 characters are always ...
34
votes
2
answers
93k
views
Convert OpenSSH private key into SSH2 private key
Is there a way to convert existing pair of OpenSSH keys to the SSH2 (ssh.com format) pair of keys?
UPD: since there are some answers about ssh-keygen suddenly appeared, I'll explain where I came ...
33
votes
3
answers
43k
views
How to decrypt hostnames of a crypted .ssh/known_hosts with a list of the hostnames?
I try to find a script to decrypt (unhash) the ssh hostnames in the known_hosts file by passing a list of the hostnamses.
So, to do exactly the reverse of:
ssh-keygen -H -f known_hosts
Or also, to ...
15
votes
3
answers
24k
views
sign_and_send_pubkey: signing failed for RSA key; from agent: agent refused operation
I have a new machine running debian sid on which I generated a new ssh key-pair. I wanted to find a convenient way to copy this new key-pair to various other machines using my old Ubuntu machine and ...
14
votes
2
answers
24k
views
How to compare different SSH fingerprint (public key hash) formats?
When I log in to an SSH server/host I get asked whether the hash of its public key is correct, like this:
# ssh 1.2.3.4
The authenticity of host '[1.2.3.4]:22 ([[1.2.3.4]:22)' can't be established.
...
14
votes
3
answers
52k
views
Add key to authorized_users without needing to restart sshd
I am trying to add a public key to a server but I don't want to restart the sshd service for it to take effect. The reason is that restarting the ssh service seems to be disruptive for other users who ...
14
votes
1
answer
10k
views
Can I build a Docker container from Dockerfile in an interactive way with allocation of some pseudo TTY?
I build container from below Dockerfile:
FROM ubuntu:14.04
...
RUN apt-get update && apt-get install -y vim
#RUN ssh-keygen -f /root/.ssh/id_rsa -N strongpass123$%^
RUN ssh-keygen -f /root/....
14
votes
1
answer
7k
views
Check presence of a hostname under custom port in known_hosts
I need to add a check if the hostname is already present in the known_hosts file.
Normally I would do something like that:
ssh-keygen -H -F hostname
However, that does not seem to work for me in this ...
7
votes
2
answers
3k
views
Is there a way to list what types of key ssh-keygen supports?
The man page for ssh-keygen on my system (Fedora 35) says that the following types of keys are supported:
-t dsa | ecdsa | ecdsa-sk | ed25519 | ed25519-sk | rsa
Specifies the type of key to ...
6
votes
2
answers
2k
views
how to append public keys to remote host instead of copy it
I used in my bash script the follwing cli , in order to send the public key to remote machine
sshpass -p $pass scp /root/.ssh/authorized_keys root@$remote_host:~/.ssh/authorized_keys
but since we ...
6
votes
2
answers
19k
views
Converting SSH2 RSA Private Key to .pem using openssl
When i try to convert SSH2 RSA format based private key to .pem format, using openssl i am getting the below error.
[jbadmin@xxxxxxx .ssh2]$ openssl req -x509 -key /home/jbadmin/.ssh2/id_rsa_2048_a -...
6
votes
2
answers
6k
views
pem file difference - ssh-keygen vs openssl
I generated my public/private key pair using
ssh-keygen -t rsa -b 2048 -v
and then needed a .pem file and followed this https://serverfault.com/questions/706336/how-to-get-a-pem-file-from-ssh-key-...
5
votes
3
answers
11k
views
How to understand ssh-keygen and ssh-copy-id?
As far as my understanding, machine(A) ssh-keygen generates a key, and ssh-copy-id gives this key to another machine (B), is it?
But when this is done, to test whether this is done or not is using ...
5
votes
1
answer
3k
views
How to verify fingerprint of Dropbear RSA host key?
When I connect to my Dropbear SSH server for the first time, I get the following message:
me@laptop:~$ ssh me@server
The authenticity of host 'server' can't be established.
RSA key fingerprint is ...
5
votes
1
answer
4k
views
What does `ssh-keygen -r` do if a public key is not specified?
Short Question
I'm assuming that ssh-keygen -r hostname uses a default public key. I would have thought that it would default to ~/.ssh/id_rsa.pub, but that does not appear to be the case. So what is ...
5
votes
2
answers
1k
views
How to copy public key to the server that doesn't allow password?
I configured my server to not allow password authentication. Now I have a new machine in a remote location, how is it possible for me to generate an ssh key and do an ssh-copy-id to the server if the ...
5
votes
2
answers
2k
views
Does Gnome Keyring support new-format OpenSSH private keys?
Does gnome-keyring support SSH private keys that are saved in the newer OpenSSH file format? Will Gnome Keyring automatically import those private keys?
In more detail: When generating a SSH private ...
4
votes
3
answers
8k
views
How to merge keys, or handle keys with the same file name?
I created a key for logging into a server (using ssh-keygen) with the name id_rsa, and so in my .ssh directory there is id_rsa.pub and id_rsa.
The reason I used this name, is because when I tried ...
4
votes
2
answers
962
views
What elements affects the key pairs generated by ssh-keygen?
I use the ssh-keygen -t rsa to generate the RSA key pairs. I see that in the id_rsa.pub file, I see the username and the hostname.
But I want to know that what elements will affects the key pairs. ...
4
votes
0
answers
547
views
bash + how to avoiding duplicate entries in authorized_keys (ssh) in bash
Popular methods of adding an ssh public key to a remote host’s authorized_keys file include using the ssh-copy-id command, and using bash operators such as >> to append to the file.
An issue ...
3
votes
2
answers
449
views
Is there a one liner which can list public key fingerprints with authorized_keys as input?
I'd like to audit the authorized_keys file on a number of servers and match them with known AWS key fingerprints.
Is there a one-liner which incorporates ssh-keygen -lf which will output the ...
3
votes
1
answer
3k
views
Generate hashed name for SSH known_hosts
Is there an easy way to generate hashed hostnames to be added to the ~/.ssh/known_hosts file?
I'd like to add a @cert-authority line to the ~/.ssh/known_hosts file.
Obviously the ssh-keygen command ...
3
votes
1
answer
2k
views
SSH asking me for passphrase which doesn't have any passphrase
I have generated the keys in Ubuntu 14.04 system using the following commands to use with ssh.
ssh-keygen -t rsa -b 2048
openssl rsa -in id_rsa -outform pem > pk_rsa.pem
openssl rsa -in pk_rsa....
3
votes
0
answers
29k
views
OpenSSH private key screwed up: Load key: invalid format [closed]
When attempting to change my SSH private key passphrase, I get the following error message from ssh:
Load key "/home/me/.ssh/id_rsa.pub": invalid format
The password encryption still works and my ...
2
votes
2
answers
92
views
Use X SSH key when logging in to Y remote user?
I'm looking for a way to set a specific SSH key while logging to a remote host with a particular username. Is this possible within the SSH config file?
For example:
Use key "id_rsa-test" for ...
2
votes
2
answers
278
views
How to know if I can use ssh keypairs?
After running successfully, my build script attempts to copy the final binary onto my FTP server using the scp command. Since the build takes a while, I don't want to be prompted for my password every ...
2
votes
1
answer
8k
views
Fedora, where to put my ssh keys to login? [duplicate]
I just recently started a VPS using Fedora. Upon creation of the VPS I was asked if I wanted to use SSH keys (which I did). Now, to connect as root to the VPS, I do not need to enter a password.
Now ...
1
vote
1
answer
132
views
How to generate keys after creating user with adduser --disabled-password
On a remote server I want to create a normal user and ONLY allow access via a key but I do NOT want to create the account with a password first and then disable password access later. In my admin ...
1
vote
3
answers
345
views
Where is the undo button in Linux? If I created an SSH key and copied the public key to a NAS, how would I undo or delete it?
I created an SSH key using ssh-keygen -t rsa.
Then I copied the key to the NAS, so I wouldn't have to enter a password using ssh-copy-id.
I realized that I did it for the wrong user, so now I need to ...
1
vote
4
answers
17k
views
How to create .pem file - full process
I want to create a .pem file to connect to the server.
I know that I can use ssh-keygen, But I want to use it for a specific user, And I need a script that will do for me all process.
My need is to ...
1
vote
1
answer
5k
views
show values of an ed22519 private key stored in OpenSSH format
(note this question uses both 'openssh' and 'openssl' in the text, I am not confusing the two.)
If I use openssh to general an RSA keypair (ssh-keygen) then I can use 'openssl rsa -in ...' to view ...
1
vote
2
answers
1k
views
ssh public key not getting copied over
I created a public/private key pair using the ssh-keygen -t rsa in my ~/.ssh folder.
I then copied the key over using the ssh-copy-id [email protected] command and received this notification.
...
1
vote
1
answer
3k
views
how to create an ssh key-pair for a service account
I would like to generate an ssh key pair for a service account on one machine to access another machine via ssh.
When I generate the key with my user, my username is embedded in the public key.
E.g. ...
1
vote
1
answer
5k
views
ssh-keygen -y error: load failed
I want to check correctness of a pair of RSA key. As far as I know, I can crate a public key from a private key by using the below command, and then compare two public key if are equal or not:
ssh-...
1
vote
2
answers
1k
views
SSH key based login not working
I am trying to setup SSH key based login from server A to server B.
I ran ssh-keygen on server A and used ssh-copy-id to copy the id_rsa.pub to server B.
When I try to ssh user@serverB from server A, ...
1
vote
2
answers
1k
views
How to get the email of the logged in user when login occurs through SSH keys?
I’m using bash shell and Ubuntu 18.04. I SSH into the server using a fairly standard RSA public-private key set up, where I put my public key in the .ssh/authorized_keys file of the server, entry ...
1
vote
1
answer
2k
views
How to convert RFC4716 private keys to PEM private keys?
How to convert RFC4716 private keys to PEM private keys in ubuntu 20.04?
For our project we generated ssh keys on a device running the latest openssh software. JSch complained about authentication:
...
1
vote
1
answer
1k
views
Reverse SSH works but not passwordless. Getting password prompt
I have two systems
Personal MacOS Laptop to be referred as system-Laptop having user laptopuser. It does not have "NAT"
Server Linux to be referred as system-Server having user serveruser ...
1
vote
1
answer
1k
views
SSH key accepted but remote host asks for password
I'm trying to get two server to connect via ssh keys.
These two servers had working ssh key authentication before, but one of them failed and was restored from a backup.
Since then, the key does not ...
1
vote
1
answer
95
views
Can I add SSH key to my machine that another user generated on their machine?
Another user and I are both using the same Ubuntu machine. They created an SSH key and disabled password authentification. Now I can no longer ssh into my user account on the Ubuntu machine. He saved ...
1
vote
2
answers
489
views
SSH Password-protected Private Key Still Visible
I thought it was not be possible to view the content of a password-protected private key file without actually inputing a password.
Very surprisingly though, I can still see the content of my private ...
1
vote
2
answers
2k
views
SSH key not found on remote machine [closed]
I have the following setup: I have my laptop A, a computer B, and a remote machine C. C can only be accessed from B via ssh, B may be accessed via ssh from A or used directly. A is always used ...
1
vote
2
answers
886
views
How to generate SSHFP records with OpenWrt/Dropbear?
How to generate SSHFP records for a Dropbear instance at OpenWrt? I have dropbearconvert and openssh-keygen installed, but nothing works. Always invalid format or similar errors. There are two host ...
1
vote
0
answers
866
views
Generating SSH key (ed25519-sk) with FIDO2 token fails with error "Key enrollment failed: requested feature not supported"
I am trying to generate SSH key using FIDO2 HW token (GoTrust Idem Key, USB-A) connected with command:
ssh-keygen -O no-touch-required -t ed25519-sk -vvv
and it fails with following error:
Generating ...
1
vote
1
answer
424
views
SSH public key will not send to server
I have read through a number of sites to no avail. So I need to see if someone else can see what I am doing wrong.
I am using ubuntu 18. Here is ssh -v output:
debug1: Found key in /home/leithner/....
1
vote
0
answers
2k
views
"no matching key exchange method found. Their offer: diffie-hellman-group1-sha1". How to fix the client not the server
So we recently updated our server and found an old linux client was failing to login and generating a "no matching key exchange method found. Their offer: diffie-hellman-group1-sha1", on our ...
1
vote
0
answers
1k
views
How to ssh-add elliptic curve key?
I'm trying to use a newly generated elliptic curve key with git version control for GitLab.
I am using a Xubuntu 16.04.
My OpenSSH version is: OpenSSH_7.2p2 Ubuntu-4ubuntu2.4, OpenSSL 1.0.2g 1 Mar ...
1
vote
0
answers
278
views
Very slow SSH connection unrelated to GSSAPIAuthentication option
I am having trouble connecting to remote machine through SSH machine (I cannot change SSH configuration on that machine though I can login without any delay from other machines).
I have commented out ...
0
votes
3
answers
1k
views
Is there a central repository of SSH keys on a system? Does SSH keygen put the private key in that location?
I just generated a public and private key with ssh key gen. I uploaded the public key onto a gitlab (basically a clone of git hub) system for my university and got an email saying that I successfully ...