![]() It may be a brutal way, but I am sure they are no leftovers! □īy taking less than 30 minutes to come to this solution, I estimate that I save at least the same amount of time for myself for the next five years. To remove old public keys of previous installations, I also add the deletion of the. # Add back our key, as we have remove the former authorized keys, along with the new one! Sshpass -e ssh-copy-id -i ~/.ssh/id_rsa.pub -o StrictHostKe圜hecking=no || echo "FAILED" ![]() # Export the password into an environment variable # ssh-copy-id -i ~/.ssh/id_rsa.pub SERVERĮcho ". # If you want to copy your key to only one server # to remove the pain from typing each time our password # Script to automatically add our public key on a list of servers Alternative using xargs, sshpass and ssh-copy-id: Assuming your credentials living in credentials.txt in format user:passwordserver: cat credentials.txt root:insecure192.168.0.1 foo:insecure192.168.0.2 bar:realsecure192.168.0.3 You could do: tr ':' ' ' < credentials. So I glued together with some answers and I came with the Bash program below: #!/bin/bash I looked upon the Internet, but I did not find a perfect solution for me. So, I decided to try to add more automation to that part of my script. Windows Terminal SSH Public Key Authentication.□ With more than 20 machines that I want to be able to connect without being prompting my password, I knew that I would need to enter the same amount of times my complicated password… And it was only the minimum, as I could get it wrong… ❌ Use SSH Keys, Cron and Rsync to Automatically Backup a Linux PC to a Synology NAS.With that, you do not need to enter your password each time you log in to that server.īut it has a little (and normal) drawback: the first time you connect to the server to install a new SSH public key, you need to enter your password. Ssh-copy-id -i ~/.ssh/id_rsa.pub Excerpt of my procedureįor those that do not know the useful ssh-copy-id command, it is a tool part of OpenSSH that adds an SSH public key on a server as an authorized key. Ssh-copy-id -i ~/.ssh/id_rsa.pub -i ~/.ssh/id_rsa.pub. □ Fortunately, I have a semiautomatic procedure to setup myself quickly, but there was a part that did not really strike a chord in me: # Add my public key to the principal servers (one command at at a time) Ssl_dhparam /etc/letsencrypt/ssl-dhparams.Last month, I receive a more recent laptop at my workplace and I needed to reinstall my distribution, Manjaro, on it. ![]() ![]() Include /etc/letsencrypt/nf # managed by Certbot Ssl_certificate_key /etc/letsencrypt/live//privkey.pem # managed by Certbot Ssl_certificate /etc/letsencrypt/live//fullchain.pem # managed by Certbot ![]() "chownUser": "ubuntu"//Which user needs to own the files "deployTo": "/var/www/html/",//Where should we deploy the GIT Repo "sslCert": "/etc/letsencrypt/live/",//What SSL Certificate will we use Then modift your config.json to match your settings nano config.json } systemctl restart nginx certbot certonly -nginxĬlone and install the githook mkdir /var/www/GITwebhook/ cd /var/www/GITwebhook/ git clone. Modify your /etc/nginx/sites-available/defualt The ssh copy id command takes the following syntax: ssh-copy-id options userhost-ip where user is the username of the user on the remote host and host-ip is the IP address of the remote server. Generate a private deploy key with no passphrase ssh-keygen -t rsa -b 4096 -C "your email" cat /home/ubuntu/.ssh/id_rsa.pub Save this result in Github under Settings -> deploy keys you DO NOT need write access for this hook Install your webstack apt update apt -y upgrade apt -y autoremove apt install -y mongodb npm certbot nginx python-certbot-nginx git-hub npm install -g pm2 pm2 startupĮdit your hostname echo "" > /etc/hostname ![]()
0 Comments
Leave a Reply. |