LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 06-29-2010, 04:05 AM   #1
mengoshmink
Member
 
Registered: Nov 2003
Distribution: Fedora
Posts: 36

Rep: Reputation: 1
Question rsync sending data from the client to the server?


Hi all,
I hope someone can shed some light on what I am doing. I am wondering if I just have things back to front.

Server (MESH):
Fedora 13
Firewall ports open tcp 22(ssh), tcp 873(rsync)
sshd service started

Client (RADIUS):
Fedora 13
Firewall ports open tcp 22(ssh)
sshd service started

Step 1.
Create network eg hardware, network address etc

Step 2.
Test network
ping client to server
Quote:
[mengoshmink@RADIUS ~]$ ping -c 3 mesh
PING mesh.config (192.168.1.72) 56(84) bytes of data.
64 bytes from mesh.config (192.168.1.72): icmp_seq=1 ttl=64 time=0.392 ms
64 bytes from mesh.config (192.168.1.72): icmp_seq=2 ttl=64 time=0.289 ms
64 bytes from mesh.config (192.168.1.72): icmp_seq=3 ttl=64 time=0.282 ms

--- mesh.config ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 0.282/0.321/0.392/0.050 ms
[mengoshmink@RADIUS ~]$
ping server to client
Quote:
[mengoshmink@MESH ~]$ ping -c 3 radius
PING radius.config (192.168.1.69) 56(84) bytes of data.
64 bytes from radius.config (192.168.1.69): icmp_seq=1 ttl=64 time=0.303 ms
64 bytes from radius.config (192.168.1.69): icmp_seq=2 ttl=64 time=0.316 ms
64 bytes from radius.config (192.168.1.69): icmp_seq=3 ttl=64 time=0.292 ms

--- radius.config ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 0.292/0.303/0.316/0.022 ms
[mengoshmink@MESH ~]$
Step 3.
Create a folder and files on the server and client for test purposes
Client
Quote:
[mengoshmink@RADIUS ~]$ ls -l /tmp/test/
total 0
-rw-rw-r--. 1 mengoshmink mengoshmink 0 Jun 29 00:40 testRADIUS
-rw-rw-r--. 1 mengoshmink mengoshmink 0 Jun 29 09:34 testRADIUS-1
[mengoshmink@RADIUS ~]$
Server
Quote:
[mengoshmink@MESH ~]$ ls -l /tmp/test/
total 0
-rw-rw-r--. 1 mengoshmink mengoshmink 0 Jun 29 07:54 testMESH
-rw-rw-r--. 1 mengoshmink mengoshmink 0 Jun 29 07:54 testMESH-2
[mengoshmink@MESH ~]$
Step 4.
Create server-side config file
Quote:
[root@MESH mengoshmink]# nano /etc/rsyncd.conf
Code:
#motd file = /etc/rsyncd.motd
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock

[testpath]
   path = /tmp/test
   comment = Test comment
   uid = nobody
   gid = nobody
   read only = no
   list = yes
   auth users = mengoshmink
   secrets file = /etc/rsyncd.scrt
Step 5.
Create server-side secrets file and set access to it
Quote:
[root@MESH mengoshmink]# nano /etc/rsyncd.scrt
Code:
mengoshmink:secret
Quote:
[root@MESH mengoshmink]# chmod 600 /etc/rsyncd.scrt
Step 6.
Start rsync daemon on the server
Quote:
[root@MESH mengoshmink]# rsync --daemon
[root@MESH mengoshmink]#
Step 7.
View file list on the server, remotely
Quote:
[mengoshmink@RADIUS ~]$ rsync rsync://mesh/testpath/
Password:
drwxrwxr-x 4096 2010/06/29 09:17:24 .
-rw-rw-r-- 0 2010/06/29 07:54:04 testMESH
-rw-rw-r-- 0 2010/06/29 07:54:14 testMESH-2
[mengoshmink@RADIUS ~]$
Step 8.
Transfer files from the server
Quote:
[mengoshmink@RADIUS ~]$ rsync -rv rsync://mesh/testpath/ /tmp/test/
Password:
receiving incremental file list
testMESH
testMESH-2

sent 103 bytes received 203 bytes 122.40 bytes/sec
total size is 0 speedup is 0.00
Quote:
[mengoshmink@RADIUS ~]$ ls -l /tmp/test/
total 0
-rw-rw-r--. 1 mengoshmink mengoshmink 0 Jun 29 09:54 testMESH
-rw-rw-r--. 1 mengoshmink mengoshmink 0 Jun 29 09:54 testMESH-2
-rw-rw-r--. 1 mengoshmink mengoshmink 0 Jun 29 00:40 testRADIUS
-rw-rw-r--. 1 mengoshmink mengoshmink 0 Jun 29 09:34 testRADIUS-1
[mengoshmink@RADIUS ~]$
All looks good so far

Now for the problem
Transfer files to the server
Quote:
[mengoshmink@RADIUS ~]$ rsync -rv /tmp/test/ rsync://mesh/testpath/
Password:
sending incremental file list
testMESH
testMESH-2
testRADIUS
testRADIUS-1
rsync: mkstemp "/.testMESH.rc5Wzb" (in testpath) failed: Permission denied (13)
rsync: mkstemp "/.testMESH-2.s3IIJU" (in testpath) failed: Permission denied (13)
rsync: mkstemp "/.testRADIUS.qlYvTD" (in testpath) failed: Permission denied (13)
rsync: mkstemp "/.testRADIUS-1.qM9j3m" (in testpath) failed: Permission denied (13)

sent 229 bytes received 84 bytes 69.56 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1042) [sender=3.0.7]
[mengoshmink@RADIUS ~]$
FYI
I have not written it here but I can successfully transfer files by ssh / scp.

Any comments or suggestions welcome.
Thank you in advance.

Last edited by mengoshmink; 06-29-2010 at 04:37 AM.
 
Old 06-29-2010, 04:11 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
Right so it's failing to make a temp file in the root of the filesystem, should that user be able to do that? you can use the -T or --temp-dir option to specify a different location for temporary files.
 
Old 06-29-2010, 04:17 AM   #3
mengoshmink
Member
 
Registered: Nov 2003
Distribution: Fedora
Posts: 36

Original Poster
Rep: Reputation: 1
and our survey says ...
Quote:
[mengoshmink@RADIUS ~]$ rsync -rv -T /tmp /tmp/test/ rsync://mesh/testpath/
Password:
sending incremental file list
testMESH
testMESH-2
testRADIUS
testRADIUS-1
rsync: mkstemp "/tmp/.testMESH.rTzOBB" (in testpath) failed: No such file or directory (2)
rsync: mkstemp "/tmp/.testMESH-2.M3ONZs" (in testpath) failed: No such file or directory (2)
rsync: mkstemp "/tmp/.testRADIUS.qwhOnk" (in testpath) failed: No such file or directory (2)
rsync: mkstemp "/tmp/.testRADIUS-1.J3NPLb" (in testpath) failed: No such file or directory (2)

sent 229 bytes received 84 bytes 125.20 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1042) [sender=3.0.7]
 
Old 06-29-2010, 06:04 PM   #4
mengoshmink
Member
 
Registered: Nov 2003
Distribution: Fedora
Posts: 36

Original Poster
Rep: Reputation: 1
Thumbs up I think I have found the solution.

I think I have found the solution.

Edited /etc/rsyncd.conf
Code:
#motd file = /etc/rsyncd.motd
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock

[testpath]
   path = /tmp/test
   comment = Test comment
   uid = mengoshmink
   gid = mengoshmink
   read only = no
   list = yes
   auth users = mengoshmink
   secrets file = /etc/rsyncd.scrt
Command run on the client
Quote:
[mengoshmink@RADIUS ~]$ rsync -rv /tmp/test/ rsync://mesh/testpath/
Password:
sending incremental file list
testRADIUS-1
testRADIUSdir/
testRADIUSdir/testRADIUS

sent 171 bytes received 50 bytes 49.11 bytes/sec
total size is 0 speedup is 0.00
The critical change being the UID and/or the GID in the server-side /etc/rsyncd.conf Everything else has remained the same.

Quote:
uid
This parameter specifies the user name or user ID that file transfers to and from that module should take place as when the daemon was run as root. In combination with the "gid" parameter this determines what file permissions are available. The default is uid -2, which is normally the user "nobody".

gid
This parameter specifies the group name or group ID that file transfers to and from that module should take place as when the daemon was run as root. This complements the "uid" parameter. The default is gid -2, which is normally the group "nobody".
I have tried commenting out the two lines and I get an error, if I change just the uid or gid the file transfers successfully. However I would recommend you set the uid when the files are received they are chown-ed to that uid with read and write access whereas group and other members only have read access.

For example:
/etc/rsyncd.conf
Code:
#motd file = /etc/rsyncd.motd
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock

[testpath]
   path = /tmp/test
   comment = Test comment
   uid = mengoshmink
   gid = nobody
   read only = no
   list = yes
   auth users = mengoshmink
   secrets file = /etc/rsyncd.scrt
Files on the client:
Quote:
[mengoshmink@RADIUS ~]$ ls -lR /tmp/test/
/tmp/test/:
total 4
-rw-rw-r--. 1 root mengoshmink 0 Jun 29 09:34 testRADIUS-1
drwxrwxr-x. 2 root mengoshmink 4096 Jun 29 20:16 testRADIUSdir

/tmp/test/testRADIUSdir:
total 0
-rw-rw-r--. 1 root mengoshmink 0 Jun 29 00:40 testRADIUS
Command run on the client:
Quote:
[mengoshmink@RADIUS ~]$ rsync -rv /tmp/test/ rsync://mesh/testpath/
Password:
sending incremental file list
testRADIUS-1
testRADIUSdir/
testRADIUSdir/testRADIUS

sent 171 bytes received 50 bytes 23.26 bytes/sec
total size is 0 speedup is 0.00
[mengoshmink@RADIUS ~]$
Files received on the server:
Quote:
[mengoshmink@MESH ~]$ ls -lR /tmp/test/
/tmp/test/:
total 4
-rw-r--r--. 1 root root 0 Jun 29 22:53 testMESH
-rw-r--r--. 1 root root 0 Jun 29 22:53 testMESH-2
-rw-r--r--. 1 mengoshmink nobody 0 Jun 29 23:53 testRADIUS-1
drwxr-xr-x. 2 mengoshmink nobody 4096 Jun 29 23:53 testRADIUSdir

/tmp/test/testRADIUSdir:
total 0
-rw-r--r--. 1 mengoshmink nobody 0 Jun 29 23:53 testRADIUS
I have yet to try using different uid/gid values for different rsync 'modules' to see what happens.

I have done a quick test using the -a option (which includes -p to preserve permissions) and it has given me the same results as above but this could well be me doing something wrong.

Ultimately transmitting the files by ssh (rsync -e /usr/bin/ssh) is a much better method but I have yet to test to see what it does (if anything) to the file/folder permissions.

References:
http://www.linuxformat.com/forums/vi...ighlight=rsync

http://www.gaztronics.net/rsync.php

http://www.unix.com/shell-programmin...t-uid-gid.html

http://samba.anu.edu.au/ftp/rsync/rsyncd.conf.html

http://everythinglinux.org/rsync/

http://samba.anu.edu.au/rsync/documentation.html

Last edited by mengoshmink; 06-29-2010 at 06:06 PM.
 
1 members found this post helpful.
Old 09-11-2010, 04:28 PM   #5
lazardo
Member
 
Registered: Feb 2010
Location: SF Bay Area
Posts: 100

Rep: Reputation: Disabled
Did you try "rsync -rv --inplace /tmp/test/ rsync://mesh/testpath/" ?
 
Old 09-11-2010, 04:33 PM   #6
mengoshmink
Member
 
Registered: Nov 2003
Distribution: Fedora
Posts: 36

Original Poster
Rep: Reputation: 1
No, --inplace is not a switch that I had tried. What does it do?
 
Old 07-20-2012, 09:17 PM   #7
romagnolo
Member
 
Registered: Jul 2009
Location: Montaletto
Distribution: Debian GNU/Linux
Posts: 93

Rep: Reputation: 4
Quote:
Originally Posted by mengoshmink View Post
I think I have found the solution.
I confirm that is a solution and it worked on my debian which as yours runs rsync daemon as root.
 
1 members found this post helpful.
Old 07-21-2012, 04:33 PM   #8
mengoshmink
Member
 
Registered: Nov 2003
Distribution: Fedora
Posts: 36

Original Poster
Rep: Reputation: 1
Pleased to hear it. I must implement this solution to my new clients and file server.
 
  


Reply

Tags
rsync


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
sending data to server? Mr.mick-duck Linux - Server 4 07-08-2009 09:29 AM
UDP server: how to stop the server sending data kumarvkm Linux - Newbie 0 02-21-2009 03:33 PM
rsync: server vs client kenneho Linux - Server 8 02-13-2009 07:34 AM
Sending integer from server to client Diabolic_Soul Programming 2 12-27-2006 06:16 PM
Sending data from one server to the other ganninu Linux - General 6 12-10-2003 06:06 AM


All times are GMT -5. The time now is 04:20 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration