use ssh key pair on pve?

Beau

New Member
Mar 24, 2023
9
0
1
Hi, all I have a question on ssh keys and proxmox I am not on a cluster I would ssh key for the root user.
I know I need to edit sshd_config but I am looking for help on what to change not to break things
 
Hi,
you can simply add your ssh key to the pve hosts authorized_keys by running a command like ssh-copy-id -i path/to/keyfile root@host from the client.
 
Hi Chris,
the client is windows 11 i have made the key with puttygen
when I look at pve /etc/ssh i do not see authorized_keys
thanks for any help
 
Hi the first key is called ssh-rsa does my key need to replace that or can it be any name?
 
ssh-rsa is the key format or type, not the name.
Don't edit the generated key, just copy it with WinSCP or manually and that's it.
 
Hi Chris,
the client is windows 11 i have made the key with puttygen
when I look at pve /etc/ssh i do not see authorized_keys
thanks for any help
Hi,
please append the full content of the newly generated ssh public key from the Windows client to the /root/.ssh/authorized_keys file on the PVE host (make sure there is a newline after the existing keys). The run pvecm updatecerts, which merges the newly added key also to /etc/pve/priv/authorized_keys, relevant for PVE.
 
If anyone else needs this information, @JayLaCroix

has a video here: ProxMox Create SSH Key Pairs

The only thing I noticed is that finding the private key in putty is slightly different from the video.

The path is:

Connection > SSH > Auth > Credentials

Another user here on ProxMox forum has asked an identical question > How to add own ssh key for root user

Also, I'm not sure what the comments about WinSCP are about? I used Putty with the PuttyGen that downloads with Putty on Win 11.

It was a very fast and easy ;)
 
Last edited:
If anyone else needs this information, @JayLaCroix

has a video here: ProxMox Create SSH Key Pairs

The only thing I noticed is that finding the private key in putty is slightly different from the video.

The path is:

Connection > SSH > Auth > Credentials

Another user here on ProxMox forum has asked an identical question > How to add own ssh key for root user

Also, I'm not sure what the comments about WinSCP are about? I used Putty with the PuttyGen that downloads with Putty on Win 11.

It was a very fast and easy ;)
Thanks for this - it looked easy, even for me. I believe I've followed the video to a T; here's what I've done:
  1. Generate and saved pub and priv keys in PuttyGen.
  2. Saved priv key on my Windows laptop, and mapped the priv key in Putty to my session, and saved the session.
  3. Added the pub key to the /etc/pve/priv/authorized_keys file. There is one other pub key in there already (I didn't put it there, this is a fresh install of Proxmox)
  4. Close out of regular/password enabled SSH session and SSH back in to make sure the new pub key is saved properly; it is.
  5. Close out of Putty
  6. Use saved SSH session mapped to priv key to log back in, and I get a Server refused our key error like this:

Am I adding the pub key to the right place? The ls -l ~/.ssh command below shows (I think?) the location of the authorized_keys file


Code:
root@pve:~# ls -l ~/.ssh
total 12
lrwxrwxrwx 1 root root   29 Jan  7 05:57 authorized_keys -> /etc/pve/priv/authorized_keys
-rw-r----- 1 root root  117 Jan  7 05:57 config
-rw------- 1 root root 1811 Jan  7 05:57 id_rsa
-rw-r--r-- 1 root root  390 Jan  7 05:57 id_rsa.pub


I noticed there is one other (already existing) pair of pub/priv keys the authorized_keys file called id_rsa and id_rsa.pub. Asuume I should just leave these alone?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!