Create global SSH key

jelle_tempelman

New member
Joined
Aug 5, 2024
Messages
2
Hi all,
First of all, I am fairly new to using SSH keys. I think I understand the basics, but I might be mistaken and need to approach it differently.

I would like to access my Bitbucket repositories via SSH without manually authenticating each time.

How it works on my local machine; I've created an ssh-key, copied the value of the .pub file, and added it to bitbucket. Than I did some configuration in my ssh config, and boom, I only need to enter the keyphrase for the ssh-key not my bitbucket application password.

But somehow this doesn't work with DirectAdmin. I have created an public ssh-key using the DA interface, and when I do so, I see the files appear in the ~/.ssh/ folder. When I copy the value of the .pub file, and give it to bitbucket, at first it still didn't work. I did some debug and found this:

Bash:
debug1: Trying private key: /home/admin/.ssh/id_rsa
debug1: Trying private key: /home/admin/.ssh/id_dsa
debug1: Trying private key: /home/admin/.ssh/id_ecdsa
debug1: Trying private key: /home/admin/.ssh/id_ed25519
debug1: Trying private key: /home/admin/.ssh/id_xmss

turns out, the file must be names either of that names. So i've deleted the ssh-key, and created one named id_rsa, copied the .pub, gave it to bitbucket and... that worked. But not for all users. That doesn't surprise me, since it's saved in the ~/.ssh/ folder, and not somewhere in the /etc/ssh/ folder.

I've viewed the content of the /etc/ssh/ folder and found some pre-made ssh-key pairs. I can not open the keys itself, but I can see the content of the .pub file. Problem solved I thought, so I copied the value of the ssh_host_rsa_key.pub file gave it to bitbucket, tried to connect to bitbucket and... nothing. Probably because it only looks for files with that 5 specific file names.

So, I am a bit out of ideas now. Is it possible what I want, or not. How do I do such a thing. I'd highly appreciate some help!

Thanks in advance :)

Jelle
 
Hi, to my understanding, there is no global SSH key. The key always belongs to a user. If you create the key for the 'admin' user then you can only connect to bitbucket with the admin user (not root user for example).
 
Hi,

Thanks for the reply. I know that it is possible to add global public keys. I have created one, and made it a global key, so I can login with my SSH-key for each user on the server. So it is possible to add global public keys, but maybe just not global private keys?
 
Back
Top