LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-26-2009, 11:32 AM   #1
Rudy
Member
 
Registered: Aug 2003
Location: United States
Distribution: Ubuntu 9.10, Red Hat
Posts: 49

Rep: Reputation: 15
Rsync connecting to a remote server


I am running rsync version 2.6.8 on a RedHat box.

I'm having trouble getting rsync to connect to the remote server. I piped in a grep of "password" on rsync's man page, and I see "you will receive a password prompt when you connect ..."

I ran
Code:
rsync -n -r --perms rsync://user@host/src/* rsync/
where user@host was the username, and the trailing rsync/ is my dest folder. I did not get a password prompt, and rsync failed to connect, because the connection was refused.

Any ideas?
- David
 
Old 08-26-2009, 11:43 AM   #2
fordeck
Member
 
Registered: Oct 2006
Location: Utah
Posts: 520

Rep: Reputation: 61
Check the firewall/iptables to see if you need to open port 873

Regards,

Fordeck
 
Old 08-26-2009, 12:33 PM   #3
Rudy
Member
 
Registered: Aug 2003
Location: United States
Distribution: Ubuntu 9.10, Red Hat
Posts: 49

Original Poster
Rep: Reputation: 15
I emailed the support staff at the datacenter and asked them to open up the port for a specific IP address. They responded with the following:

Quote:
CSF doesn't allow the setting of a port by IP, but it will block an IP if anyone tries to execute an attack against it.

I did, however, have to open up the port in CSF, and you should be able to access it now. Please let me know if this is not the case.
I realized after making my initial post here that I did not do a good job in explaining my working environment. The (remote) webserver is running RedHat and rsync version 2.6.8 - which really doesn't matter. The computer that I am actually using to connect to the remote server is a Windows computer running cygwin. On Cygwin, I am running rsync version 3.0.4.

After receiving our datacenter's response, I tried issuing the following command (again) through Cygwin:
Code:
rsync -n -r --perms rsync://user@host/src/* rsync/
I got a "connection refused" message again.

Any other ideas? Is there a way that I can verify that port 873 has been opened up? I'm not very familiar with CSF or with iptables. I do, however, have root ssh access to the server.
 
Old 08-26-2009, 01:19 PM   #4
Myiagros
Member
 
Registered: Mar 2009
Distribution: Ubuntu, CentOS 5.3
Posts: 75

Rep: Reputation: 18
Your syntax to me looks wrong but it might just be the way I use rsync. My scripts look something like this:
rsync -avz user@host:/source /destination
Note: I haven't used rsync on Windows, just Linux.
 
Old 08-26-2009, 01:28 PM   #5
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 356

Rep: Reputation: 43
Quote:
Any other ideas? Is there a way that I can verify that port 873 has been opened up? I'm not very familiar with CSF or with iptables. I do, however, have root ssh access to the server.
Check that you are running rsync as a daemon on the redhat server and if so, do netstat -pantu|grep 873 to make sure that it is indeed listening. Then from the windows host, use nmap against the server IP to scan for the open port 873.

If you are not running rsync that way on the server, then your syntax should look like Myiagros's, where the transport is SSH.
 
Old 08-28-2009, 10:06 AM   #6
Rudy
Member
 
Registered: Aug 2003
Location: United States
Distribution: Ubuntu 9.10, Red Hat
Posts: 49

Original Poster
Rep: Reputation: 15
Thanks guys. I already knew that I wasn't running rsync as a daemon on the server, so the syntax that Myiagros suggested worked. However, I am facing a new dilemma. I want to stick this rsync into a cron.

Here's what I currently have (which works):
Code:
rsync -aPH --log-file=log.txt user@host:/home/user rsync/home/
I want to change it so that I can include user@host's password. Would the best solution be something like the following into my shell script?
Code:
export RSYNC_PASSWORD=password
rsync -aPH --log-file=log.txt user@host:/home/user rsync/home/
Or will I need to do something a little different?
 
Old 08-28-2009, 10:33 AM   #7
rn_
Member
 
Registered: Jun 2009
Location: Orlando, FL, USA
Distribution: Suse, Redhat
Posts: 127
Blog Entries: 1

Rep: Reputation: 25
Quote:
Originally Posted by Rudy View Post
Would the best solution be something like the following into my shell script?
Code:
export RSYNC_PASSWORD=password
rsync -aPH --log-file=log.txt user@host:/home/user rsync/home/
Or will I need to do something a little different?
That or the --password-file option, or my personal preference: setup an ssh pub/priv key pair.
 
Old 08-28-2009, 10:36 AM   #8
Rudy
Member
 
Registered: Aug 2003
Location: United States
Distribution: Ubuntu 9.10, Red Hat
Posts: 49

Original Poster
Rep: Reputation: 15
I have been told that by exporting the RSYNC_PASSWORD, this would create a security hole, and that instead I should use SSH Key Authentication. I am in the midst of researching how I go about this, and will post the steps shortly. I'm almost to the point of being ready to go to work on it.
 
Old 08-28-2009, 12:09 PM   #9
rn_
Member
 
Registered: Jun 2009
Location: Orlando, FL, USA
Distribution: Suse, Redhat
Posts: 127
Blog Entries: 1

Rep: Reputation: 25
Quote:
Originally Posted by Rudy View Post
I have been told that by exporting the RSYNC_PASSWORD, this would create a security hole, and that instead I should use SSH Key Authentication. I am in the midst of researching how I go about this, and will post the steps shortly. I'm almost to the point of being ready to go to work on it.
That's good, cuz this is a perfectly good research topic and i'd hate to deprive anyone of the satisfaction of finding the answer themselves . still, if you run into a block, you know where to go.
 
  


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
Need help setting up rsync server and connecting DeltaCopy traigo Linux - Server 1 02-24-2009 01:08 AM
rsync not delete non existing files on remote server proNick Linux - Software 2 09-10-2008 03:47 AM
rsync Syntax Question for Connecting to Remote Windows Machine Linux31 Linux - Networking 3 10-09-2005 02:55 PM
Connecting to a remote server Mossaiby Linux - Networking 5 07-30-2004 03:38 PM
Connecting to remote server tracey Linux - Newbie 1 08-11-2003 07:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:22 AM.

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