LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-09-2013, 07:24 AM   #1
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,374

Rep: Reputation: 240Reputation: 240Reputation: 240
Smile SCP Copy files


hello gurus, how do i use SCP to copy files that are new or updated to another server?

Can it be done using SCP or some other methods?

any input is greatly appreciated.

Thank you.
 
Old 12-09-2013, 07:43 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,574

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Quote:
Originally Posted by JJJCR View Post
hello gurus, how do i use SCP to copy files that are new or updated to another server?
For new/updated/different look to use: rsync
 
Old 12-09-2013, 07:44 AM   #3
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
This one should be handled by rsync which can use ssh. Else you would have to create list of files you want to copy and pass that on to scp.
 
Old 12-09-2013, 07:46 AM   #4
tombelcher7
Member
 
Registered: Feb 2008
Location: Surrey
Distribution: Debian
Posts: 207

Rep: Reputation: 5
How do you mean?

Machine A | Machine B

Only files from machine A that are newer than those that may exist at the destination (machine B)

Or something else?
 
Old 12-09-2013, 08:32 AM   #5
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,374

Original Poster
Rep: Reputation: 240Reputation: 240Reputation: 240
Smile

Quote:
Originally Posted by tombelcher7 View Post
How do you mean?

Machine A | Machine B

Only files from machine A that are newer than those that may exist at the destination (machine B)

Or something else?
Yes files on machine A will be copied to Machine B, but only files that does not exist on Machine B or files that are modified will be copied over to Machine B.

If files does exist and exactly same copy from Machine A will be skipped.

How to do it on rsync?

Thanks.
 
Old 12-09-2013, 08:40 AM   #6
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,574

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Quote:
Originally Posted by JJJCR View Post
How to do it on rsync?
man rsync :P

For making a copy of a tree of folders I generally use:

Code:
rsync -az --delete /path/to/source/ username@hostb:/path/to/dest/
You'll have to enter the password unless you use keypairs which you can then specify with:

Code:
rsync -az --delete -e "ssh -i /path/to/.ssh/key" /path/to/source/ username@hostb:/path/to/dest/
 
1 members found this post helpful.
Old 12-09-2013, 09:56 AM   #7
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,374

Original Poster
Rep: Reputation: 240Reputation: 240Reputation: 240
hi TenTenths, do you mean i still have to generate an ssh key? or i just need the path to point to the ssh key?
 
Old 12-09-2013, 10:31 AM   #8
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,574

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Quote:
Originally Posted by JJJCR View Post
hi TenTenths, do you mean i still have to generate an ssh key? or i just need the path to point to the ssh key?
If you have an existing key that works between hosta and hostb you can use that, as long as it's valid for the username your specifying on hostb
 
Old 12-12-2013, 02:51 AM   #9
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,374

Original Poster
Rep: Reputation: 240Reputation: 240Reputation: 240
i ended up using this command, hope this will help someone else along the way:

Quote:
rsync --update --progress -av -e ssh /home/data_files/ user_name@192.168.0.7:/home/data_files
will just need to enter the root or the user name password of the destination server

Last edited by JJJCR; 12-12-2013 at 02:52 AM. Reason: edit
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to copy files using scp bijoya Linux - Security 4 10-26-2012 08:34 AM
[SOLVED] SCP to copy files using putty JJJCR Linux - Newbie 6 09-05-2011 03:16 AM
Using scp to copy files between servers. muskiediver Linux - General 1 07-11-2006 04:52 PM
copy files....using scp help me suguname Mandriva 2 01-26-2005 02:14 AM
copy files....using scp help me suguname Mandriva 5 01-25-2005 06:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration