Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have two linux boxes.

At one there's a cron job that tars a few files. I want the other box to download it, automatic.

Now, I intentionally didn't specify any method to achieve this because I simply might limit myself with an average solution.


Searching the web, I could use rsync but there are no concise examples.

Another option would be to create a dedicated SSH user with very limited rights (dir jail, no dir listing etc'), which will be used by the slave box to download the tarball.

What options do I have? Any link to a good example?

Requirements: Currently I don't mind about bandwidth etc'. The file is not too big anyway.

share|improve this question
    
you want to copy the tar file created by cron job right? –  max Oct 23 '12 at 12:12

2 Answers 2

This is for password less login.

First create a id_rsa.pub key using this method

[max@localhost .ssh]$ ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/home/max/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/max/.ssh/id_rsa.
Your public key has been saved in /home/max/.ssh/id_rsa.pub.
The key fingerprint is:
93:24:83:37:eb:5e:13:97:d1:ea:bd:0a:d8:29:9f:ba max@localhost.localdomain
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|     .     .     |
|    . = . . .    |
|     . * . +     |
|      . S +      |
|     . o * .     |
|      + * . .    |
|     . + +   .   |
|      Eoo ...    |
+-----------------+

Share id_rsa.pub key to remote system

This key will present under .ssh/ directory under your home directory

Using this command you can copy the id.rsa.pub key to remote system (min@10.10.*.*)

[max@localhost .ssh]$ ssh-copy-id -i id_rsa.pub min@10.10.*.*
The authenticity of host '10.10.*.* (10.10.*.*)' can't be established.
RSA key fingerprint is 2b:bf:e1:e9:c6:76:b0:2d:a1:45:0f:2a:53:05:10:15.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.10.*.*' (RSA) to the list of known hosts.
student@10.10.*.*'s password: 
Now try logging into the machine, with "ssh 'min@10.10.*.*'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

Now type rsync command to copy files (To automatic copy write a crontab, and write this command)

This is the syntax of rsync

rsync [OPTION...] SRC... [DEST]

[max@localhost .ssh]$ rsync -avz min@10.10.*.*:/home/min/test /home/max/Desktop
receiving incremental file list
test

sent 30 bytes  received 89 bytes  79.33 bytes/sec
total size is 0  speedup is 0.00
share|improve this answer

I could use rsync but there are no concise examples.

$ rsync -avz /directoryname/ username@otherservername:/other/directoryname/
share|improve this answer
    
poni mentioned that automatic backup, so we have to do key sharing also, otherwise it will prompt password. –  max Oct 23 '12 at 13:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.