LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   rsync error "connection refused" (https://www.linuxquestions.org/questions/linux-server-73/rsync-error-connection-refused-477620/)

cuschu 08-26-2006 03:33 PM

rsync error "connection refused"
 
I am using Ubuntu server, no GUI, and I would like ot have rsync running to backup my Windows laptop. I have installed rsync and created the rsyncd.conf file

Code:

[backup]
    path = /home/cuschu/backup
    comment = My backup folder
    uid = cuschu
    gid = users
    read only = false
    auth users = cuschu
    secrets file = /etc/rsyncd.conf.secrets

I installed cygwin in order to run rsync and this is what I get

Code:

$ rsync 192.168.1.105::backup
rsync: failed to connect to 192.168.1.105: Connection refused (111)
rsync error: error in socket IO (code 10) at /home/lapo/packaging/tmp/rsync-2.6.
6/clientserver.c(98)

I know my server resides at 192.168.1.105, but I have no idea how to configure the firewall. The error message looks like the ubuntu firewall is blocking my request to backup. How do I configure the firewall to open up port 111?

uselpa 08-27-2006 08:44 AM

Are you sure that your rsync server is actually running on your linux box?

cuschu 08-27-2006 05:30 PM

I think that it is but I am not sure, as I am rather new to linux. How do I check if it is running? Also, is it possible that I have only installed the rsync client, not the server. How do I check that? When I apt-get rsync it says that I have the newest version.

cuschu 08-28-2006 01:01 AM

apt-get install rsync must work for the server side because I finally got it to sync. I could not figure out how to open another port. However, I found that if you go through ssh, it is more secure and the firewall will be a little easier to work with. Anyway, after the rsync.conf is set up and cygwin is loaded on the windows side here is the line that will make it back up (for future reference).

Code:

rsync -e ssh -av --delete "/cygdrive/c/Documents" root@server:/backups
You could use another user besides root, but I have not added that to the rsyncd.conf, yet.

uselpa 08-28-2006 01:09 AM

ssh will slow it down as well, and requires you to have a password or a certificate. You need to decide if the security is needed, i.e. if you are on a secure network or not. But it's certainly a good habit to use ssh whereever possible.

From the point of view of the firewall, ssh and rsync have the same level of complexity: one port to open (ssh:22 rsync:873).

It's good that you've got it running, but it might still be useful to try the native rsync protocol as well, if only to find out why it didn't work in the first place.

cuschu 08-28-2006 06:11 PM

This is just on my home LAN, so security through ssh is probably overkill. However, when Ubuntu Server is installed SSH port 22 is already open and functioning. However, I could not get port 873 to open up, any ideas on how to open it? I could figure it out through a GUI, but I did not install one on this server.

uselpa 08-29-2006 01:49 AM

I must admit I'm lazy and always use Guarddog as a firewall. Without GUI, you'll have to tinker with the iptables command. I am not at a Linux box now but I remember that iptables has a list command (try `man iptables`) which shows the rules. If you post them, we can go further.

rynodp 10-21-2008 07:19 AM

firewall
 
just open the related ports on your firewall

JimBass 10-21-2008 08:41 AM

The command to see what firewall rules are used on a linux box (itself) is:

Code:

iptables -L
That might print just a few lines or it might spit pages. If you have many rules, you'll want to pipe the output either to a file or into the less or more command to only show one screen at a time -

Code:

iptables -L > /tmp/fiirewall    (then read /tmp/firewall)
OR
iptables -L | less
iptables -L | more

Also, for future reference, it would help new users (or people new to rsync) to point out that the command you listed above:

Code:

rsync -e ssh -av --delete "/cygdrive/c/Documents" root@server:/backups
is run on the cygwin (windows) machine, not the server. As I read through the thread, I saw you trying to connect from the Ubuntu box to the Ubuntu box in the beginning, and never saw how you got data from the win box to Ubuntu. Also, it looks like your command would only backup the c:\Documents folder, which is fine if you have a c:\Documents folder. Most of the time, I think windows puts things like My Documents in c:\Documents and Settings?

When backing up windows servers to linux boxes, I have found it easier to use rsyncd on the windows box. I do it on the LAN, so I have no need of encrypting the traffic, which is the big benefit of using ssh. If the data ever touches the internet, you are far better with ssh+rsync than rsyncd. There are opensource ports of rsyncd packages available for windows, both as batch files, services, and I've even seen and used a GUI program that runs an rsync server on windows.

Peace,
JimBass

marxiano533 03-23-2010 02:42 PM

I had this problem and solved it seting the permissions of the password file to 700.
Hope this helps you.
Regards

ranjithnada 07-30-2012 10:50 AM

I've had this exact same error and i resolved it using ubuntu rsync community page. I was missing the configuration of the rsync Daemon.

From the Ubuntu community rsync help page

1. Edit the file /etc/default/rsync to start rsync as daemon using xinetd. The entry listed below, should be changed from false to inetd.

RSYNC_ENABLE=inetd
2. Install xinetd because it's not installed by default.

$ sudo apt-get -y install xinetd
3. Create the file /etc/xinetd.d/rsync to launch rsync via xinetd. It should contain the following lines of text.

service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
flags = IPv6
}
4. Create the file /etc/rsyncd.conf configuration for rsync in daemon mode. The file should contain the following. In the file, user should be replaced with the name of user on the remote machine being logged into.

max connections = 2
log file = /var/log/rsync.log
timeout = 300

[share]
comment = Public Share
path = /home/share
read only = no
list = yes
uid = nobody
gid = nogroup
auth users = user
secrets file = /etc/rsyncd.secrets
5. Create /etc/rsyncd.secrets for user's password. User should be the same as above, with password the one used to log into the remote machine as the indicated user.

$ sudo vim /etc/rsyncd.secrets
user:userpassword
6. This step sets the file permissions for rsyncd.secrets.

$ sudo chmod 600 /etc/rsyncd.secrets
7. Start/Restart xinetd

$ sudo /etc/init.d/xinetd restart


It worked for me hope this helps

kzutter 06-29-2013 02:04 PM

No need for xinetd
 
Rsync is disabled by default.

Edit /etc/default/rsync and change the line RSYNC_ENABLE=true
and restart the daemon

sudo service rsync restart

And you are good to go!

lleb 06-29-2013 04:17 PM

just a side note question: why not mount the windows directories via SAMBA or as a cifs mount point and use rsync on your Ubuntu server instead of fighting with trying to force rsync to run inside MS Windows. run it native on the Ubuntu box with much less hassle.

kzutter 07-01-2013 11:23 AM

Many ways to skin a cat - this is mine...
 
Quote:

Originally Posted by lleb (Post 4980908)
just a side note question: why not mount the windows directories via SAMBA or as a cifs mount point and use rsync on your Ubuntu server instead of fighting with trying to force rsync to run inside MS Windows. run it native on the Ubuntu box with much less hassle.

1. Running rsync on Win is not a "fight".
2. Local business security rules may prevent sharing folders on local machines.
3. Volume Shadow Copy cannot be done from the Linux side
4. Can schedule from the local side when convenient for local resources.
5. Should I continue????


All times are GMT -5. The time now is 12:00 AM.