LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   rcp connection refused (https://www.linuxquestions.org/questions/linux-server-73/rcp-connection-refused-847389/)

thiyagarajancs 11-30-2010 01:19 AM

rcp connection refused
 
Dear friends,

I can use rcp commands by
/usr/bin/rcp test.txt linux181:/test/test.txt

But when i use,
"rcp test.txt linux181:/test/test.txt"
It show the following error,

connect to address 173.148.4.54 port 544: Connection refused
Trying krb4 rcp...
connect to address 173.148.4.54 port 544: Connection refused
trying normal rcp (/usr/bin/rcp)
Permission denied.

(or)
connect to address 173.148.4.54 port 544: Connection refused
Trying krb4 rcp...
connect to address 173.148.4.54 port 544: Connection refused
trying normal rcp (/usr/bin/rcp)
No route to host

===========================================

[root@linux54 ~]# cat /etc/xinetd.d/rsh
# default: on
# description: The rshd server is the server for the rcmd(3) routine and, \
# consequently, for the rsh(1) program. The server provides \
# remote execution facilities with authentication based on \
# privileged port numbers from trusted hosts.
service shell
{
socket_type = stream
wait = no
user = root
log_on_success += USERID
log_on_failure += USERID
server = /usr/sbin/in.rshd
disable = no
}
============================================
[root@linux54 ~]# cat /root/.rhosts
173.148.4.71 linux181
173.148.4.54 linux54
=============================================

No firewall on both m/c.

Please help tme to solve this issue.

BertM 11-30-2010 07:14 AM

Aside from rcp being very unsafe (because everything is being sent in cleartext over the network) and that you should use ssh or scp instead, maybe the following thread offers some useful advice:

http://www.linuxquestions.org/questi...denied-639111/

I think in particular this part, because you seem to have put your machines hostname after the ip-address in .rhosts:

Quote:

Originally Posted by beadyallen (Post 3139766)
Alright, your problem is most likely a mapping of usernames. I'm guessing that on the remote machines, you've got a .rhosts file containing a list of valid ip addresses. This will probably work fine for the 'root' and 'oracle' accounts, since these will exist on both machines. However, it's likely that your local username isn't valid on the remote machines. To fix it, you can add a line to the .rhosts file. For instance, if you want user 'geoff' (which is valid on your local machine, with ip address 192.168.1.32) to be able to copy things as the 'oracle' user on a remote machine, add the following to the .rhosts in the remote oracle user's home directory:
Code:

192.168.1.32 geoff
However, as I hinted at before, DON'T USE RCP/RSH/RLOGIN. Please. Especially not across the internet. Change to using ssh/scp instead. It's much more secure.


casperpache 12-21-2010 11:12 AM

Beadyallens response was exactly what was the problem with my issue.

My scenario....
i have ServerA.doodle.com that contained a file called /transfers/TestA.
I also have ServerB.doodle.com where i wanted to copy the file to as user bob.
A user called bob needed to log onto ServerB and copy the TestA file from ServerA.


To get this to work....
On ServerA, I had to create a .rhosts file in the home directory for bob (/home/bob/.rhosts) and add the below line....

ServerB.doodle.com bob
This line allows bob on ServerB to access and copy files from ServerA

Then I logged onto ServerB as bob and ran the rcp command as below:-

rcp ServerA:/transfers/TestA /home/bob/


The main problem i had which had me going round in circles was that i never had the correct hostname of ServerA in the .rhosts file.
This needs to be input as your server resolves it.
i.e. I originally thought that because in my hosts file i had the nickname as ServerA it would figure it out, so i had...
ServerA bob

After amending this to the below it worked fine.
ServerA.doodle.com bob

Hope this helps someone.


All times are GMT -5. The time now is 06:56 PM.