This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
computing:remote-upgrades [2019/06/16 03:41] – oemb1905 | computing:remote-upgrades [2020/01/27 20:36] – oemb1905 | ||
---|---|---|---|
Line 19: | Line 19: | ||
| | ||
Once that is done, put in some parameters that will provide nice feedback to you while you execute the command from primary workstation: | Once that is done, put in some parameters that will provide nice feedback to you while you execute the command from primary workstation: | ||
- | | + | |
#!/bin/bash | #!/bin/bash | ||
+ | echo "I am beginning"; | ||
+ | cat /etc/motd | ||
apt update | apt update | ||
apt dist-upgrade | apt dist-upgrade | ||
apt autoremove | apt autoremove | ||
apt autoclean | apt autoclean | ||
- | echo "I just finished | + | echo "I just finished"; |
+ | echo " | ||
+ | echo " | ||
+ | echo " | ||
+ | echo " | ||
+ | echo " | ||
hostname | hostname | ||
date | date | ||
uname -a | uname -a | ||
echo "If there is another, I will begin that now ..."; | echo "If there is another, I will begin that now ..."; | ||
+ | sleep 10s | ||
Edit sudoers so that this command can be run on target without password, (or, if your prefer, do not do this, and then you can enter the password for each target as the primary workstations script executes): | Edit sudoers so that this command can be run on target without password, (or, if your prefer, do not do this, and then you can enter the password for each target as the primary workstations script executes): | ||
Line 36: | Line 44: | ||
Add the following to the file, obviously changing " | Add the following to the file, obviously changing " | ||
- | + | | |
username ALL=(root) NOPASSWD: / | username ALL=(root) NOPASSWD: / | ||
- | + | | |
- | Now you are ready to create the script on the primary workstation that will pass the apt-remote script to the target workstations: | + | Now you are ready to create the script on the primary workstation |
sudo touch / | sudo touch / | ||
Line 48: | Line 56: | ||
In the file that opens, use the following script parameters or something similar. | In the file that opens, use the following script parameters or something similar. | ||
| | ||
- | hostsa="haackremote.mooo.com lthsf.mooo.com" | + | # |
- | #run on each host | + | hosts="server.com 10.55.55.9" |
- | for i in $hostsa; | + | |
- | do | + | |
- | | + | |
- | ssh -t -p 60000 $i sudo apt-remote; | + | |
- | done; | + | for i in $hosts; |
- | And here is how I adjusted the primary workstation script to do this with a remote host that requires an openvpn connection to be established first: | ||
- | |||
- | #!/bin/bash | ||
- | cd / | ||
- | sudo openvpn hostname.mooo.com.ovpn & | ||
- | sleep 10s | ||
- | |||
- | hostsa=" | ||
- | for i in $hostsa; | ||
do | do | ||
+ | |||
echo "I will now update" | echo "I will now update" | ||
- | ssh -t -p 59999 targetuser@$i sudo apt-remote; | + | |
+ | ssh -t $i screen -S aptremotescreen | ||
done; | done; | ||
- | cd ~ | ||
- | sudo killall openvpn | ||
- | sleep 10s | ||
- | These configs an be found on the haackingclub | + | If you would prefer to do these types of backups with a vpn connection (instead of port forwarding), |
+ | |||
+ | Option 1 - Using vpn connection, connect from localhost to remote host/server with ssh and screen, and then execute a script | ||
+ | |||
+ | Use this script on your localhost: [[https:// | ||
+ | Use this script on the remote host that you are backing up: [[https:// | ||
+ | |||
+ | Option 2 - Using vpn connection, connect from localhost to remote host/server with ssh and screen, and then execute a script on the server that uses rsync over ssh to send its backup back to you at localhost: | ||
- | * [[https://codetalkers.services/ | + | Use this script on your localhost: |
| | ||
- | --- //[[netcmnd@jonathanhaack.com|oemb1905]] | + | --- //[[jonathan@haacksnetworking.com|oemb1905]] |