LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   scp command (http://www.linuxquestions.org/questions/linux-newbie-8/scp-command-727265/)

Swapna173 05-20-2009 08:06 AM

scp command
 
I want to copy files between two linux machines

1) I want to copy files on the 2nd machine to the 1st machine.
2) Move the copied files in the 2nd machine from one directory to other directory. (i.e. to take backup)
3) I am trying to use scp command to copy files in Step 1.
4) and ssh command for both step 1 & step2
5) Now my question is : if ssh-agent is corrupted or killed will scp work?

The main thing over here is I want to avoid creating script files on the 2nd machine for copying and taking backup

Thanks in advance

eco 05-20-2009 08:11 AM

I'd have a serious look at rsync if you want to backup files. It's the best and will handle hidden files, etc a lot better.

You can also use it as a daemon and run a repository.

Just my 2c.

inside-man 05-20-2009 08:20 AM

Hello, scp and rsync with ssh (as far as i know) , both use the ssh service for communication, this means it is necessary to have such daemon running. But here my question, have you ever seen an ssh service crashing? O.K. there were reasons that the target computer is not answering (hard disks full, whole computer hangs), but in this case it makes no sense to have ssh running and the rest is blocked. I have never seen a working machine where only ssh daemon was hanging, in most cases a lot of other things were not working correctly but on ssh the machine was reachable and managable.

By the way: rsync is a mighty tool it should fulfill all your requirements....

Regards Randolf Balasus

linuxlover.chaitanya 05-20-2009 08:28 AM

Though ssh agent will really not hang by itself but for exceptional reasons, scp session can end if you are using it on terminal emulator and if the terminal is closed then the session will end without completing the task.

eco 05-20-2009 09:14 AM

Quote:

Originally Posted by linuxlover.chaitanya (Post 3546892)
if you are using it on terminal emulator and if the terminal is closed then the session will end without completing the task.

To solve that you can use the screen command which will allow you to discnnect from a session and connect later on.

chrism01 05-21-2009 02:54 AM

If this is a one-off exercise, use scp to copy across systems, and ssh to use local cp between dirs.
If its a regular thing eg weekly backups, then yes, use rsync (with ssh option) & cron.


All times are GMT -5. The time now is 08:09 PM.