PstSystems

A place to record by projects

You can use rsync with an ssh key for password-less transfers. This is useful for doing unattended backups using a cron job and a script or to keep your website in line with a local copy.

First you will need to generate the Private and Public Keys on the device you want to run the script on.

yo...

rsync -vP --inplace [SOURCE] [DESTINATION]

rsync -vP --inplace "/home/userfolder/file.xxx" "username@hostIP:/home/foldername/file.xxx"

RSYNC FLAGS

-a          archive mode is -rlptgoD (no -A,-X,-U,-N,-H)

-r          recurse into directories
-l          copy symlinks as symlinks
-p          p...

result=$($mysql -u $user -p$pass -e 'show slave status\G' | grep Last_SQL_Error: | sed -e 's/ *Last_SQL_Error: //')

seconds_behind=$($mysql -u $user -p$pass -e 'show slave status\G' | grep Seconds_Behind_Master: | sed -e 's/ *Seconds_Behind_Master: //')

if [[ -n "$result" || $seconds_behind -ge...

Login to the server you want to connect from

Run the following command to see if existing SSH keys are present:

ls -al ~/.ssh/id_*.pub
Generate a new SSH key pair.
ssh-keygen -t rsa -b 4096

In order to be able to login to your server without a password, copy the public key to the server

s...

As the root user, edit the sshd_config file found in /etc/ssh/sshd_config

Add the following line to the file

PermitRootLogin yes

Restart the SSH server:

systemctl restart sshd

or

service sshd restart

Login as root and Create keys on Master

make a directory to hold SSL certs

mkdir -p /var/lib/mysql
cd /var/lib/mysql

Use openssl to generate a key file.

openssl genrsa 2048 > ca-key.pem

set CA common name to "MariaDB admin"

openssl req -new -x509 -nodes -days 730 -key ca-key.pem -out ca-...