This repository automatically distributes "authorized_keys" files to servers.
On a push to this repository, all authorized_keys files are updated on all servers.
- find or create the key you want to add (e.g.
~/.ssh/id_rsa.pub
) - add the key to the
authorized_keys.<servername>
file in this repository (for the server you want to get access to) - push the changes to this repository
This script connects to the server via SSH with the rootkey to update the authorized_keys file.
For this script to work it needs SSH access to the server. For this the server needs to have the contents of the rootkey.pub in the servers authorized_keys file.
- You need to have SSH access to the server. Note down the Hostname and the User you want to use.
- add the rootkey_*.pub from this repository to the servers ~/.ssh/authorized_keys file (in the users home directory)
- add new host to "config" file
Host <hostname> Hostname <hostname> User <user> Port <port> # optional
- add host to ".github/workflows/update-all.yml" file
- push the changes to this repository
-
Now check with your own key if you have access to the server
ssh <user>@<hostname
-
ONLY CONTINUE IF YOU HAVE ACCESS WITHOUT NEEDING A PASSWORD
-
Now you need to disable password login and root login via SSH
sudo nano /etc/ssh/sshd_config
find and change the following lines
PasswordAuthentication no PermitRootLogin no
-
restart the SSH service
sudo systemctl restart sshd