Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

moving files via ssh

by Anonymous Monk
on May 13, 2003 at 12:31 UTC ( #257705=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,

I am looking for a program or script that will do the following:
1. Login to my linux box via ssh using a keyfile & password
2. Copy all files from /var/BACKUP to the local machine

Its going to be used to move daily backup files off my server on to a local machine. The local machine can be running either windoze or linux - just incase anybody knows of any windows programs that will do this :-/

Replies are listed 'Best First'.
Re: moving files via ssh
by zby (Vicar) on May 13, 2003 at 12:35 UTC
    Two things (that can help): scp (command similar to unix rcp, and cp, but working with the SSH protocol), and rsync (which can synchronize directories over SSH).
Re: moving files via ssh
by december (Pilgrim) on May 13, 2003 at 13:00 UTC

    You don't need anything else than ssh (more exactly, scp) when both machines are running Linux (or some other unix). Just use 'scp -r backup@backupmachine:/var/BACKUP /var' or something. The key thing will happen automatically; and if you use a dedicated 'backup' user, this is a quite secure solution.

    I don't know anything about windows, except that it won't natively interact with any open, non-MS technology. I guess there must be some third-party programs with similar functionality. Perhaps openssh itself, with cygwin...

      Cygwin is pretty good anyway. You can get a complete OpenSSL and OpenSSH suite for Cygwin, and it's works well enough.

      If you are adicted to a GUI then PuTTY is pretty good, and includes a nice SSH terminal tool, and a set of batch-able command line tools.

      You should also be able to get various SSH tools for Perl from CPAN, but I've not used them, and I don't know if they are easy to get for Windows either.

      Cheers. How does the key thing happen automaticaly? i have a key file for the machine, do i need to copy this to any specific directory? i realy want this copy to run overnight (non-interactivly), so i don't want it asking for passwords or locations of key files.
        Simple summary:

        challenge-response authentication. Generate your ssh-keys with <ssh-keygen -d> for ssh2. You will have the files $HOME/.ssh/ and $HOME/.ssh/id_dsa. The - file is your public key. Copy that file to the target + to $HOME/.ssh/ and do a "cd .ssh; cat >>authorized_keys". Now you should be able to connect to the target machine via ssh without using passwords.
        On a unix box you achive this by the cron daemon. The documentation how to use it you can find with: man crontab.
Re: moving files via ssh
by powerhouse (Friar) on May 13, 2003 at 14:19 UTC
    Here is one that I use, and I love it... However you have to do it manually, it does not do it for you, at least the version I have. They do have multiple versions :o).

    Program named: SSH Secure Shell
    Company: SSH Communications Security

    Hope that helps your search...


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://257705]
Approved by smitz
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2017-08-19 12:02 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (310 votes). Check out past polls.