ITMiami
asked on
Send a file via cron job using ssh
I need to automate a backup, currently it's being created as a tar.gz ball and I download manually via ftp, I was wondering if it's possible to run a one line command from the shell to upload this file to another server using the ssh protocol, or to create a script and chmod 755 that would work too... Has anyone done this before? Is there another way?
Thanks for reading
Thanks for reading
You may upload using csp or sftp (which are part of ssh S/W packages) through a crontab job. But you need to know that scp or sftp is slower than ftp since it encrypts data while sending.
If you need a sample script, then it can be provided.
If you need a sample script, then it can be provided.
if you want to use sftp scp or to copy files you need to take into consideration that you will be prompted for a password in your script or cronjob therefore you will have to use public keys instead of passwords in authentication to overcome this hurdle.
http://www.linuxjournal.com/article/8600
http://martin.ankerl.com/2005/09/22/secure-ssh-cvs-scp-without-password-prompt/
Webmin also has a feature that allows you to skip on public key authentication and do remote backups
http://www.linuxjournal.com/article/8600
http://martin.ankerl.com/2005/09/22/secure-ssh-cvs-scp-without-password-prompt/
Webmin also has a feature that allows you to skip on public key authentication and do remote backups
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
As another method of doing the same thing using rsync over ssh. It is possible to use self signed certs as mentioned above to copy the files across without needing passwords.
a good doc on this is http://troy.jdmz.net/rsync/
the process is gove over in detail, setting up the cert, locking it down, defining the script, adding it to the cronjob.
Let me know if you have any issues with this.
-t
a good doc on this is http://troy.jdmz.net/rsync/
the process is gove over in detail, setting up the cert, locking it down, defining the script, adding it to the cronjob.
Let me know if you have any issues with this.
-t
what is the basis for deciding the split?
however, the answer is yes.