Operating System - Linux
1753776 Members
7295 Online
108799 Solutions
New Discussion юеВ

Copying file to remote server using rsync

 
SOLVED
Go to solution
Henry Chua
Super Advisor

Copying file to remote server using rsync

Hi Guys,
I am trying to use rsync to copy files over preserving owners, rights, group etc. but am having some problem:

rsync -avzopg -e "ssh -i /var/home/hchua/fr1httpmo01-rysnc-key" testing.txt hchua@192.168.60.71:/opt
building file list ... done
testing.txt
mkstemp .testing.txt.RSQLLk failed: Permission denied
wrote 250 bytes read 36 bytes 572.00 bytes/sec
total size is 417 speedup is 1.46
rsync error: some files could not be transferred (code 23) at main.c(620)

May I know wat is wrong?
I create the key in my home dir.. do i need special previlege to do this?

Thanks!

regards
Henry
5 REPLIES 5
Ivan Ferreira
Honored Contributor

Re: Copying file to remote server using rsync

This is an excelent document that you can follow to configure Rsync over SSH:

http://www.jdmz.net/ssh/
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
George Liu_4
Trusted Contributor

Re: Copying file to remote server using rsync

like this states,
mkstemp .testing.txt.RSQLLk failed: Permission denied

Check the permission.
Henry Chua
Super Advisor

Re: Copying file to remote server using rsync

Thanks for the help guys, I have when thru the link as per your advise, but one question, isnt it possible to rsync with the rights, ownership by using -p and -o?

Thanks!
Manuel Wolfshant
Trusted Contributor
Solution

Re: Copying file to remote server using rsync

Hi henry

Make sure you are allowed to write in /opt. Usually ordinary users may not write over there, and you are trying to do that as user hchua. I guess you will have to run as root something similar to one of the following commands on the target computer:
chmod a+w /opt
or
chgrp hchua /opt && chmod g+w /opt
or
setfacl -m u:hchua:w /opt
The last one assumes /opt resides on a filesystem which was mount with extended acl rights (mount -o remount,acl /opt)

If you are not allowed to modify /opt, then either transfer to you home dir or to /tmp
Bill Thorsteinson
Honored Contributor

Re: Copying file to remote server using rsync

If you want to retain rightes and ownership
rsync must run as root. Rsync normally creates
a new file and moves it into place once it is
copied. Newer versions also have an inplace
option to update files without copying them.

I am waiting for my log source to updated so
I don't copy current logs on the log server.