LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-08-2008, 03:13 PM   #1
krysak
LQ Newbie
 
Registered: Feb 2008
Posts: 9

Rep: Reputation: 0
Trying to use rcp


I need to use rcp to transfer some files.

But I keep getting connection refused.
I have two machines with RHEL4.
I did some search and it seemed I have to add the host on .rhosts file and add the other machine on the hosts.allow
But it still didn't work.

Can someone give a quick guide on what to do to get this working?
 
Old 04-08-2008, 04:06 PM   #2
prad77
Member
 
Registered: Mar 2008
Posts: 101

Rep: Reputation: 15
Hope you are able to ping the machine first.

For rcp look at the following files.

.rhosts - you have correctly identified. ==> mc/name username
/etc/hosts.equiv. ==? should not have a - .
/etc/hosts (make sure the host NAMES in .rhosts exist in /etc/hosts (or in nis - via ypcat hosts| grep NAME) and they match)
/etc/netgroups - if you are using netgroups, and you want to define a group like sales, to be multiple machines.

More about .rhosts - note that .rhosts is looked for in $HOME, so if you changed your root $HOME to be /home/root, or something, then copy or link your .rhosts to that area. Same for users. if you have a /users/jones, and you want them to be able to rcp, you need to verify that the .rhosts exits there (this can be overridden by netgroups)

Gentoo

Last edited by prad77; 04-17-2008 at 04:44 AM.
 
Old 04-08-2008, 04:57 PM   #3
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
you should use scp instead of rcp, it is more secure, and you can use public key authentication instead of .rhosts files.
 
Old 04-09-2008, 09:13 AM   #4
krysak
LQ Newbie
 
Registered: Feb 2008
Posts: 9

Original Poster
Rep: Reputation: 0
yeah, I can ping the machines of course.

There is no hosts.equiv file, should I create it?

There is a hosts.allow file which i added the line:
host1.fakedns.com

and on the first host I did the opposite:
host2.fakedns.com

And before you ask I can ping the machines using these names.

On the .rhosts file I did the same added the same lines.

But I still get connection refused...

I didn't want to use scp because it asks for a password, I even thought of making a little script to enter the password but I just want to see if I can enable rcp first.

Any other Ideas?
 
Old 04-09-2008, 10:41 AM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,952

Rep: Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693
Quote:
Originally Posted by krysak View Post
I didn't want to use scp because it asks for a password, I even thought of making a little script to enter the password but I just want to see if I can enable rcp first.

Any other Ideas?
If you do a key-swap between the machines, SCP won't prompt you for a password, and it's far more secure and faster than RCP.

On your local machine, as the user you're going to use on both machines, type in:

ssh-keygen -t rsa

It'll prompt you to create a directory if it doesn't exist, usually in $HOME/.ssh. It'll create files id_rsa and id_rsa.pub. Copy id_rsa.pub to authorized_keys2.

Copy the authorized_keys2 file from one machine to the other, into your $HOME directory. Then "cd $HOME/.ssh", then "cat ../authorized_keys2 >> authorized_keys2". This will append the key from one machine, into the authorized key file on the other machine. Now, both machines know who they are. Shouldn't prompt you for a password for SSH or SCP after that.
 
Old 04-21-2009, 03:02 PM   #6
wlantester
LQ Newbie
 
Registered: Apr 2009
Posts: 2

Rep: Reputation: 0
Hello.

I tried this and it worked fine for two machines, when I copied the authorized_keys2 to my third machine I got the password prompt from my server. Is this method possible with more then two machines?

Thanks.

Quote:
Originally Posted by TB0ne View Post
If you do a key-swap between the machines, SCP won't prompt you for a password, and it's far more secure and faster than RCP.

On your local machine, as the user you're going to use on both machines, type in:

ssh-keygen -t rsa

It'll prompt you to create a directory if it doesn't exist, usually in $HOME/.ssh. It'll create files id_rsa and id_rsa.pub. Copy id_rsa.pub to authorized_keys2.

Copy the authorized_keys2 file from one machine to the other, into your $HOME directory. Then "cd $HOME/.ssh", then "cat ../authorized_keys2 >> authorized_keys2". This will append the key from one machine, into the authorized key file on the other machine. Now, both machines know who they are. Shouldn't prompt you for a password for SSH or SCP after that.
 
Old 04-21-2009, 05:02 PM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,952

Rep: Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693
Quote:
Originally Posted by wlantester View Post
Hello.

I tried this and it worked fine for two machines, when I copied the authorized_keys2 to my third machine I got the password prompt from my server. Is this method possible with more then two machines?

Thanks.
I use it on dozens of machines.

The authorized_keys2 file you copy over needs to be from each machine you want to connect FROM, to the machine you want to connect TO.
 
Old 04-21-2009, 05:56 PM   #8
wlantester
LQ Newbie
 
Registered: Apr 2009
Posts: 2

Rep: Reputation: 0
yes, I just discovered it myself. I had to actually copy and paste the keys from my "clients" to the authorized_keys2 on the server so that one have entries from all my machines.

Thanks a lot for the posting, it helped me a lot!


Quote:
Originally Posted by TB0ne View Post
I use it on dozens of machines.

The authorized_keys2 file you copy over needs to be from each machine you want to connect FROM, to the machine you want to connect TO.
 
  


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
rcp command Karthikeyan Gurusamy Linux - Newbie 4 01-16-2006 11:19 PM
can't run rcp ust Linux - Distributions 0 05-09-2005 05:39 AM
Can't use rcp ust Linux - Software 5 08-31-2004 09:11 AM
RCP question cleekjc Linux - Networking 3 10-14-2003 02:13 PM
Allow rcp Eddie9 Linux - General 0 08-20-2002 03:02 AM


All times are GMT -5. The time now is 03:55 PM.

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