Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying files&directories between 2 Linux servers

Status
Not open for further replies.

tangerine0072000

Technical User
Apr 20, 2005
83
GB
Hi,

Does anyone know the best way to copy the contents of a directory from one Linux server to another.

I can see SCP will do this, but I also want the ability to copy over changes every evening. Doesn't look like scp has this capability unless someone knows otherwise.

thanks,

 
Put rsync into a cron job.

--== Anything can go wrong. It's just a matter of how far wrong it will go till people think its right. ==--
 
Very easy example

rsync -vrae /path/ dest_server:/path/

If you use SSH nm different port

rsync -vrae 'ssh -p xxx' /path/ dest_server:/path/

to delete files not present anymore on the source directory add the --delete option


rsync -vrae 'ssh -p xxx' --delete /path/ dest_server:/path/


Do not forget the "/" after the source directory; if omitted rsync will copy the whole directory again within the destination server's one.


QatQat



If I could have sex each time I reboot my server, I would definitely prefer Windoz over Linux!
 
thanks for your replies guys. Done a search for rsync, doesn't look like we have it, but thanks anyway.
 
Why don't you install it then?

if you are on fedora/RH a simple "yum install rsync" will do it.

If you are on a Debian based distro

apt-get install rsync


will do.

QatQat



If I could have sex each time I reboot my server, I would definitely prefer Windoz over Linux!
 
Is there anyway that I can rsync a windows directory to linux?

In other words my source would be a windows machine and destination is a linux or vice versa.




Thanks;

Ilker Tanli
 
You would install something like CygWin which creates a unix/linux-like command session...

I'm sure there are plenty of commercial - and maybe free - Windows-based implementations of rsync+ssh

D.E.R. Management - IT Project Management Consulting
 
One more thing, I have disabled root login on one of my servers, therefore I am receiving the following error when I try to make rsync both distributions are redhat.

$ rsync -vrae /tmp/ilker/ xxx.xxx.xxx.xxx:/tmp/

rsync: Failed to exec /tmp/ilker/: Permission denied (13)
rsync error: error in IPC code (code 14) at pipe.c(83) [receiver=2.6.8]
rsync: writefd_unbuffered failed to write 4 bytes [receiver]: Broken pipe (32)
rsync error: error in IPC code (code 14) at io.c(1119) [receiver=2.6.8]

I have also tried 'rsync -vrae /tmp/ilker/ ilker@xxx.xxx.xxx.xxx:/tmp/' and received the same error.

Why is the permission denied?





Thanks;

Ilker Tanli
 
If the windoz directory is on another machine why not try rsync over samba share?

you can call rsync from the linux server and as source use the samba share.


There are some restrictions about the --modify option normal incremental and --whole options will work.


QatQat

If I could have sex each time I reboot my server, I would definitely prefer Windoz over Linux!
 
Have you considered using scp on the Linux side and pscp (available from Putty) to perform your file transfers. It's sounds a lot simpler than using rsync (forgive me guys I am newbie Linux admin). Just my 2 cents
 
Yep, pscp is simpler but if you want to automate your process and, especially if you need to synchronise and not replace all files then scp / pscp may be a bit limited.

On windoz, scripting capabilities are close to nothing so you still will need to script on the linux side; at that point I would use rsync over smb.

QatQat


If I could have sex each time I reboot my server, I would definitely prefer Windoz over Linux!
 
Completely off-topic, but since you mention Windows scripting capabilities, it seems like MS have finally realised how dire the situation is and have released Windows PowerShell which some of my colleagues have used to great effect. Personally the language looks atrocious to me (they should have followed the brilliant 4DOS/4NT model in my opinion), but it can do lots of stuff.

Annihilannic.
 
Personally the language looks atrocious to me...""

I love that!

Thanks for the info though but somehow I do not see myself trying it out; but I agree, it was time that they tried to address the horrible shortcomings of windoz scripting.

Cheers


QaTQat

If I could have sex each time I reboot my server, I would definitely prefer Windoz over Linux!
 
If you are using ssh as a transport you can set up a public/private key pair so that no password is required. See the FAQ in this forum.

Similarly if you are using the default rsh then you can set up .rhosts (or .k5login if you have the Kerberos version) file to allow rsh from one host to another without a password. See the rlogin man page for details.

Annihilannic.
 
why not just:

mount -t smbfs -o username=<windowsuser>,fmask=777 //<server>/<share> /<localpath>

? then run a simple copy command on which ever side windows or linux. You could use '-t nfs' option if you have services for unix installed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top