Secure server backup (ftp + openssh+encode) !
Jan 12
Secure server backup logic
1) find all buckup files *.gz
2) encode them to *.gz.out
3) remove gz file
4) upload to ftp
5) remove encoded file
Secure server backup script
1 2 3 4 5 6 7 8 9 10 11 | #!/bin/sh
BACKUPDATE=`date +%Y-%m-%d`;
find . -type f -name "*.gz" -print|while read myfile
do
openssl enc -aes-256-cbc -salt -in "$myfile" -out "$myfile".out -pass pass:PaSSwordThere;
rm "$myfile" ;
curl -v -T "$myfile".out ftp://login:"FTppassThere"@ftpserveraddres.com/${BACKUPDATE}/"$myfile" -Q "MKD ${BACKUPDATE}";
curl -v -T "$myfile".out ftp://login:"FTppassThere"@ftpserveraddres.com/${BACKUPDATE}/"$myfile" ;
rm "$myfile".out ;
echo "$myfile" "\n" ;
done |
This is my first backup script!
Also decode example
openssl enc -d -aes-256-cbc -in zzzz.gz.out -out zzzz.gz -pass pass:PaSSwordThere;