Questions tagged [ssh-keys]

an authorization mechanism for SSH involving public-key cryptography.

Filter by
Sorted by
Tagged with
230 votes
11 answers
712k views

"Add correct host key in known_hosts" / multiple ssh host keys per hostname?

Trying to ssh into a computer I control, I'm getting the familiar message: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@...
Samuel Edwin Ward's user avatar
177 votes
5 answers
99k views

What's the difference between authorized_keys and authorized_keys2?

Just wanted a quick summary of the differences between them and why there are two?
Jon's user avatar
  • 2,131
137 votes
4 answers
57k views

What significance does the user/host at the end of an SSH public key file hold?

I can’t figure out why does an SSH public key file generated by ssh-keygen have a user and host at the end of it. Example: id_rsa.pub ssh-rsa ... rest of file ... /CA9gyE8HRhNMG6ZDwyhPBbDfX root@...
Basil A's user avatar
  • 2,140
135 votes
4 answers
337k views

how do you create an ssh key for another user?

I'm trying to create an ssh key for another user. I'm logged in as root. Can I just edit the files generated by ssh-keygen and change root to the user I want?
user962449's user avatar
  • 1,477
111 votes
8 answers
30k views

Why does my OpenSSH key fingerprint not match the AWS EC2 console keypair fingerprint?

When I import my OpenSSH public key into AWS EC2's keyring the fingerprint that AWS shows doesn't match what I see from: ssh-keygen -l -f my_key It is a different length and has different bytes. ...
Craig Ringer's user avatar
  • 11.2k
98 votes
1 answer
189k views

How do I validate an RSA SSH public key file (id_rsa.pub)?

Is there a command I can use to verify the public key (id_rsa.pub), just the format only. Sometimes I have added a new linebreak, sometimes the file missed the ssh-rsa prefix, so is there a command ...
Ryan's user avatar
  • 6,031
87 votes
1 answer
75k views

SSH Allow Password For One User, Rest Only Allow Public Keys [duplicate]

Is it possible with ssh to allow passwords from a certain user, but deny using passwords for everybody else? Basically I want to allow password auth for user justin but everybody else must use public ...
Justin's user avatar
  • 5,438
84 votes
16 answers
695k views

What causes SSH error: kex_exchange_identification: Connection closed by remote host?

I setup a SSH server online that is publicly accessible by anyone. Therefore, I get a lot of connections from IPs all over the world. Weirdly, none actually try to authenticate to open a session. I ...
soliz's user avatar
  • 942
74 votes
11 answers
34k views

Why is SSH password authentication a security risk?

Most guides for OpenSSH configuration advise to disable password authentication in favor of key-based authentication. But in my opinion password authentication has a significant advantage: an ability ...
Septagram's user avatar
  • 937
72 votes
8 answers
159k views

How to change a SSH host key?

I cloned a server and so they've the same RSA key fingerprint. It seems to be defined in /etc/ssh/ssh_host_rsa_key.pub. What is the correct way to change that? Thanks.
Pascal Polleunus's user avatar
69 votes
3 answers
119k views

Temporarily disable ssh public key authentication from client

Is there a way to temporarily disable public key authentication when ssh'ing, and use password authentication instead? I currently want to access remote server, but I'm using another laptop, not mine....
Nsukami _'s user avatar
  • 801
56 votes
11 answers
290k views

Is there an equivalent to ssh-copy-id for Windows?

Is there any equivalent or port of ssh-copy-id available for Windows? That is, is there an easy way to transfer SSH keys from a local machine to a remote server under Windows? In case it helps, I'm ...
Matt V.'s user avatar
  • 837
54 votes
7 answers
23k views

How to get all fingerprints for .ssh/authorized_keys(2) file

Is there a simple way to get a list of all fingerprints entered in the .ssh/authorized_keys || .ssh/authorized_keys2 file? ssh-keygen -l -f .ssh/authorized_keys will only return fingerprint of ...
childno͡.de's user avatar
47 votes
9 answers
119k views

Auto accept rsa key fingerprint from command line

I've tried yes | ssh [email protected] to try to accept the RSA key fingerprint, but am still prompted if I'm sure I want to connect. Is there a way to make this automatic?
VenomFangs's user avatar
44 votes
1 answer
44k views

What is the meaning of an equal sign = or == at the end of a SSH public key?

I just noticed that most of the ssh pubkeys in my authorized_keys end on == or = E.g. ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA9ZUwxXn2HZAAUswoaV8t2sQPvolVWDI053f0giNN154Zyi9FtWJKvyLHXoxW4IzFxgx+m6EYqXG/...
Lukas Loesche's user avatar
41 votes
8 answers
88k views

Automating ssh-copy-id

I have some arbitrary number of servers with the same user/pass combination. I want to write a script (that I call once) so that ssh-copy-id user@myserver is called for each server. Since they ...
devin's user avatar
  • 1,266
41 votes
5 answers
8k views

Smoothest workflow to handle SSH host verification errors?

This is a simple issue that we all face and probably resolve manually without giving much thought. As servers change, are re-provisioned, or IP addresses reallocated, we receive the SSH host ...
ewwhite's user avatar
  • 198k
38 votes
2 answers
4k views

Is there a security risk to disclosing your SSH known_hosts file?

I'm speaking at a conference next week about some software tools I've created. My laptop will be shown on a projector screen during this presentation. The presentation will be videotaped and posted ...
Matt Korostoff's user avatar
38 votes
7 answers
98k views

Unable to ssh to GCE: "Permission denied (publickey)"

I created a VM via Bitnami in Google Compute Engine. Previously, I was able to ssh via the Bitnami web interface. I tried to ssh via terminal on my Mac but kept getting the Permission denied (...
NEO's user avatar
  • 781
37 votes
2 answers
37k views

ssh-copy-id specifying which key and without password

I have a public key in a server(host) that I want to transfer to another server(target). The host server has a bunch of keys in .ssh/ folder, i want to copy just one of them to the target server (it'...
Lucas Mattos's user avatar
37 votes
3 answers
105k views

ssh-copy-id - permission denied (publickey) [closed]

I want to set up ssh tunnel to the mysql server which is in computer which has virtual machine. Also the tunnel has to work if the machine is restarted. So lets say A is computer with linux software. ...
Darius.V's user avatar
  • 539
36 votes
3 answers
39k views

How to configure ssh client to use private keys automatically

I'm always running ssh with the -i parameter and it's a hassle to always type in the correct key for whatever host I'm connecting to. Is there a config file or something (on Mac) to define which ...
Leopd's user avatar
  • 1,907
34 votes
1 answer
29k views

Only allow password authentication to SSH server from internal network

I have an OpenSSH 5.9p1 server running on Ubuntu Precise 12.04 which accepts connections from both the internal network and the Internet. I'd like to require public key authentication for connections ...
mgorven's user avatar
  • 31k
33 votes
3 answers
30k views

openssh - Adding an ssh key from putty to authorized_keys

I have been provided with an ssh key by a colleague to add to the authorized_keys file for an account on a linux server so they can access that account. The file looks something like this: ---- ...
Michael Slade's user avatar
28 votes
6 answers
12k views

Have a system that expires SSH keys every 90th day [closed]

I have a customer that now requires us to change every password every 90th day due to their interpretation of GDPR. That's fine for the web-based system we develop for them because we can just ...
mr D's user avatar
  • 280
28 votes
2 answers
142k views

how to connect to mongodb server via ssh tunnel

It was easy for me to connect to my remote mysql server on AWS using a sequelpro, however I'm struggling with doing the same thing with mongodb. I tried setting up an ssh tunnel via command line ...
abbood's user avatar
  • 1,127
27 votes
11 answers
79k views

SSH aborts with Too many authentication failures

I'm attempting to run this simple provisioning script but I'm encountering errors when running vagrant up and then vagrant provision commands. I read that I needed to create a /etc/ansible/hosts file ...
Ashley's user avatar
  • 528
26 votes
8 answers
32k views

A system for distributing SSH public keys

We have many different systems that are managed by several people. We have chosen to use SSH public key authentication to access those systems. This works great, as there is no need to manage or share ...
Jacek Konieczny's user avatar
25 votes
5 answers
28k views

how to SSH to EC2 without explicitly using the pem key?

I have a windows as my main OS. Using VMware player, I setup a Ubuntu server 12.4 as a guest machine. The Ubuntu server have "ubuntu" user. I created a new EC2 instance + setup pem key. From the ...
user798562's user avatar
25 votes
6 answers
24k views

Windows Password won't decrypt on AWS EC2 even with the correct private key

I created a new Windows instance on AWS EC2, using a keypair I created by uploading my public key from my local machine. The instance launched fine, but it won't decrypt the password. It reports: I'...
Craig Ringer's user avatar
  • 11.2k
24 votes
3 answers
36k views

Putting RSA keys into azure key vault

How can I store my key pair (typically the id_rsa and id_rsa.pub) in azure key vault. I want to put the public key in my GIT service and allow a virtual machine to download the private key from Azure ...
MercilessMaverick's user avatar
24 votes
2 answers
72k views

Load key "privkey.ppk" invalid format

What have I done: I'm trying to connect to my remote server with private key with ssh -i privkey.ppk root@ip But it's returning an error. Error message: Load key "privkey.ppk": invalid format root@...
AATHITH RAJENDRAN's user avatar
23 votes
5 answers
93k views

SSH Public Key Format

I have a public key in the format: ---- BEGIN SSH2 PUBLIC KEY ---- Comment: "somename-20060227" AAAAB3NzaC1yc2EAAAABJQAAAIBmhLUTJiP[and so on]== ---- END SSH2 PUBLIC KEY ---- Usually I see keys in ...
Björn's user avatar
  • 447
22 votes
7 answers
63k views

How to generate host SSH keys via ansible?

I'm trying to re-generate ssh host keys on a handful of remote servers via ansible (and ssh-keygen), but the files don't seem to be showing up. The playbook runs OK, but the files on the remote are ...
Server Fault's user avatar
  • 3,784
22 votes
9 answers
80k views

Trying to SSH in to remote computer but still asking for password

Trying to SSH in to remote computer but still asking for password. I have a number of computers running SElinux and only one of them is giving me a hard time using ssh without the password. I did ...
JMS1969SF's user avatar
  • 221
22 votes
4 answers
26k views

How do I import a RSA SSH key into GPG as the _primary_ private key?

I currently have a SSH key that I've used for a while and I'd like to start using GnuPG with a new keyring. However, given that I've used my key for ages, I would like to still use that key in GPG as ...
SineSwiper's user avatar
  • 2,638
22 votes
1 answer
14k views

ssh command line specify server host key fingerprint

Using ssh command line (OpenSSH), can I specify the server's host key fingerprint? This is possible with winscp.com using (e.g.) -hostkey="ssh-rsa 2048 AA:BB:CC...etc I have read the man page a ...
payo's user avatar
  • 323
20 votes
4 answers
2k views

Publishing id_rsa.pub for easier setup of new environments?

To make setting up passwordless SSH easier on new machines and environments, is there any reason why the id_rsa.pub file (just the public half of the key pair) could not be published somewhere on the ...
DouglasDD's user avatar
  • 552
20 votes
2 answers
3k views

Receiving a private key from server admin: ok or not?

I am to get access to a remote SFTP server. The admin has created a user for me, and generated a public/private key pair for me. Then he securely sent me the private key file, which I use for ...
matthiash's user avatar
  • 311
19 votes
4 answers
42k views

Turn off strict checking of ssh keys

Each user creates and destroys 15+ VM's per day. The VM's are created in the company's internal OpenStack cloud. Every time a new vm is assigned an ip address which has previously been handed out, ...
spuder's user avatar
  • 1,745
19 votes
4 answers
101k views

How to set public SSH key for root user on server?

I'm trying to follow Slicehost Document to setup my server. I reached SSH section. I made it as written, but when i logged out from root, i cant access root@IP_ADDRESS -p 30000 again! but i can access ...
amrnt's user avatar
  • 359
18 votes
4 answers
2k views

SSH into NAT'd servers on the same public IP address

I am trying to SSH from in office X to a few Linux boxes in office Y. The Linux boxes in office Y are behind NAT and each run on their own ports. I can successfully reach all of them through SSH, but ...
Copy Run Start's user avatar
17 votes
2 answers
6k views

Are there any security benefits to deploying custom SSH DH groups to client-only systems?

One suggested mitigative strategy against Logjam-related attacks on SSH is to generate custom SSH Diffie-Hellman groups using something like (the below being for OpenSSH) ssh-keygen -G moduli-2048....
user's user avatar
  • 4,455
16 votes
1 answer
18k views

SSH ForwardAgent multiple hops

I've been looking for a solution to the following problem for the past 2 hours with no luck. Development: I'm using publickey authentication to connect to my servers. I use ssh-agent forwarding in ...
liquidity's user avatar
  • 418
16 votes
2 answers
13k views

How to revoke an ssh certificate (not ssh identity file!)

I've generated an ssh certificate like this: ssh-keygen -f ca_key # generate a ssh keypair for use as a certificate generate a host key ssh-keygen -s ca_key -I cert_identifier -h host_key.pub specify ...
rorycl's user avatar
  • 858
14 votes
1 answer
2k views

Can Bash Tell Me Which SSH Public Key Was Used To Authenticate?

Let's say I want to track my root users. Each of them has a unique private key and their public keys have been stored in /root/.ssh/authorized_keys. Given that each user logs in with their unique key ...
PP.'s user avatar
  • 3,426
14 votes
1 answer
27k views

AuthorizedKeysFile line commented out but still seems to work

I'm setting up a server on Linode and following their Securing Your Server guide. They recommend setting up ssh key pair authentication. I have already uploaded my public key to server and the key ...
Adam Johns's user avatar
14 votes
5 answers
6k views

Choose identity from ssh-agent by file name

Problem: I have some 20-30 ssh-agent identities. Most servers refuse authentication with Too many failed authentications, as SSH usually won't let me try 20 different keys to log in. At the moment, I ...
leoluk's user avatar
  • 541
13 votes
1 answer
34k views

one ssh key file for multiple machines, instead of pair to single machine?

I am currently implementing key pair login to my server as following: generate key pair from my local laptop: me@macbook:~ $ ssh-keygen -t rsa transfer pub key from laptop to server: me@macbook:$ ...
gilzero's user avatar
  • 449
13 votes
1 answer
8k views

User@host in a SSH-RSA public key

What role does the user@host that often appears at the end of a public ssh-rsa key play? Is it necessary? Does if serve any purpose in the authentication, or is it simply a record of who and where ...
usedTobeaMember's user avatar

1
2 3 4 5
16