Setting up Slackware 13 (64-bit) (part 3)

Make your server trust your laptop+user:

#su - "your username here"

$ssh-keygen -t rsa

$scp ~/.ssh/ "remote_username"@"host_name":"target_filepath_for_key_on_the_server"

Now ssh into your server:

$ssh "remote_user"@"host_name"

$cd ~/.ssh

Insert your laptop’s public key in the authorized keys list:

$cat "target_filepath_for_key_on_the_server" >> authorized_keys

Try ssh-ing your server again (this time you should not need to type a password:

$ssh "remote_user"@"host_name"

Create an alias for your server:

#nano /etc/ssh/ssh_config

and add thisĀ  (customize it, please):

Host linode
KeepAlive yes
User httpd
Compression yes

Now you should be able to ssh into your server like this:

$ssh linode

Now use this nice backup script:

TODAY_FOLDER=/home/backup/`date +%Y-%m-%d --date "0 day ago"`/linode
YESTERDAY_FOLDER=/home/backup/`date +%Y-%m-%d --date "1 day ago"`/linode

if [ -e $pid ]
echo "Still running..."
touch $pid
if [ ! -d $TODAY_FOLDER ]; then
mkdir -p $TODAY_FOLDER
echo "copying..."

rsync --bwlimit=100 --force --no-p --progress --delete-before -aze ssh linode:~/ $TODAY_FOLDER
rm $pid

and you will have full backups (while preserving spaces as the cp command creates hardlinks) daily

Tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *