LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-30-2010, 12:05 PM   #1
d072330
Member
 
Registered: Nov 2007
Location: USA
Distribution: CentOS 5/6
Posts: 186

Rep: Reputation: 6
Question RSH Logins Not working


My new company is using rsh to connect to remote machines and run some scripts. We have a problem where we cannot connect from one machine to another. I am trying to find out what ports rsh is using. I have looked in /etc/services file and there are a bunch listed. Looking at the file it looks to me like rsh is using ports 513/514 or 543/544.

Can someone verify this for me?

Command to rsh:
rsh server_name -l account_name /script/script.ksh

Gets following error:
stderr=server_name: Permission denied.
rsh: can't establish connection.

On both of the servers involved both server names are in the .rhost files with the correct user.

Any help would be great.
 
Old 11-30-2010, 12:48 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,604

Rep: Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960
Quote:
Originally Posted by d072330 View Post
My new company is using rsh to connect to remote machines and run some scripts. We have a problem where we cannot connect from one machine to another. I am trying to find out what ports rsh is using. I have looked in /etc/services file and there are a bunch listed. Looking at the file it looks to me like rsh is using ports 513/514 or 543/544.

Can someone verify this for me?

Command to rsh:
rsh server_name -l account_name /script/script.ksh

Gets following error:
stderr=server_name: Permission denied.
rsh: can't establish connection.

On both of the servers involved both server names are in the .rhost files with the correct user.

Any help would be great.
A handy list of port numbers, from IANA:
http://www.iana.org/assignments/port-numbers

And are the names of the servers specified somewhere (DNS, /etc/hosts, etc.)? You say they're specified in the .rhost files, but could be trying to do a reverse-lookup by FQDN. Just a thought.

And another thought...is this new company crazy? RSH in 2010? You could/should easily use SSH to do this.
 
Old 11-30-2010, 12:54 PM   #3
d072330
Member
 
Registered: Nov 2007
Location: USA
Distribution: CentOS 5/6
Posts: 186

Original Poster
Rep: Reputation: 6
Tell me about it. Only been here for a month now and don't want to make any crazy changes just yet. The use of rsh will be gone early 2011 if I have my way LOL.

In regards to FQDN these machines are in DNS and dig resolves the names so don't think that is the issue. I do think it is a firewall issue but thought I would be proactive and do some searching since I have never used rsh (before my time, I guess LOL).

The end user cannot telnet server_name 513/514/543/544 right now I do believe it is a firewall issue.
 
Old 11-30-2010, 02:00 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,604

Rep: Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960
Quote:
Originally Posted by d072330 View Post
Tell me about it. Only been here for a month now and don't want to make any crazy changes just yet. The use of rsh will be gone early 2011 if I have my way LOL.

In regards to FQDN these machines are in DNS and dig resolves the names so don't think that is the issue. I do think it is a firewall issue but thought I would be proactive and do some searching since I have never used rsh (before my time, I guess LOL).

The end user cannot telnet server_name 513/514/543/544 right now I do believe it is a firewall issue.
I think you hit it on the head, there. Since you can dig and get proper name resolution, but can't telnet to those ports, chances are it's blocked somehow. Just on a "you probably checked it, but have to ask" vein, can you rsh locally on that box? Check IP tables? Enable the service? On my openSUSE systems, rsh-server is disabled by default, and you have to edit the /etc/xinetd.d/rsh file, and set "disable=no", then bounce the xinetd service. And are you running SElinux by any chance?
 
Old 11-30-2010, 02:27 PM   #5
d072330
Member
 
Registered: Nov 2007
Location: USA
Distribution: CentOS 5/6
Posts: 186

Original Poster
Rep: Reputation: 6
Quote:
can you rsh locally on that box?
Got a command to do this? I am assuming it is rsh localhost pwd or something to that fashion.

Quote:
Check IP tables?
IP tables is off.

Quote:
Enable the service?
These are the listed xinetd based services and their status:

xinetd based services:
eklogin: off
ekrb5-telnet: off
klogin: off
krb5-telnet: on
kshell: off
rexec: off
rlogin: on
rsh: on

Quote:
On my openSUSE systems, rsh-server is disabled by default, and you have to edit the /etc/xinetd.d/rsh file, and set "disable=no", then bounce the xinetd service.
/etc/xinetd.d/rsh file (no changes were made):
service shell
{
disable = no
socket_type = stream
wait = no
user = root
log_on_success += USERID
log_on_failure += USERID
server = /usr/sbin/in.rshd
}

Quote:
And are you running SElinux by any chance?
SELINUX=disabled
 
Old 11-30-2010, 02:42 PM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,604

Rep: Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960
Quote:
Originally Posted by d072330 View Post
Got a command to do this? I am assuming it is rsh localhost pwd or something to that fashion.
Kind of assumed you'd have checked all of the above already, but sometimes it's the obvious things that get overlooked.

Try "rsh -K -l <username> localhost", and see if that goes. You can also try it with a "-d" to turn on socket-debugging, then check your /var/log/messages file for messages.
 
Old 11-30-2010, 03:01 PM   #7
d072330
Member
 
Registered: Nov 2007
Location: USA
Distribution: CentOS 5/6
Posts: 186

Original Poster
Rep: Reputation: 6
rsh -l username localhost
connect to address 127.0.0.1 port 543: Connection refused
Trying krb4 rlogin...
connect to address 127.0.0.1 port 543: Connection refused
trying normal rlogin (/usr/bin/rlogin)
Password:

It does not like the -k or -K options:

usage: rsh host [ -PN / -PO ] [ -l login ] [ -n ] [ -x ] [ -f / -F] command
OR rsh [ -PN / -PO ] [ -l login ] [-n ] [ -x ] [ -f / -F ] host command

I thought by using the .rhosts file you did not have to specify a password?
 
Old 11-30-2010, 03:08 PM   #8
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,604

Rep: Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960
Quote:
Originally Posted by d072330 View Post
rsh -l username localhost
connect to address 127.0.0.1 port 543: Connection refused
Trying krb4 rlogin...
connect to address 127.0.0.1 port 543: Connection refused
trying normal rlogin (/usr/bin/rlogin)
Password:

It does not like the -k or -K options:

usage: rsh host [ -PN / -PO ] [ -l login ] [ -n ] [ -x ] [ -f / -F] command
OR rsh [ -PN / -PO ] [ -l login ] [-n ] [ -x ] [ -f / -F ] host command

I thought by using the .rhosts file you did not have to specify a password?
I think that's right, but it's been so long since I've used RSH, I'm not sure. The -K option on openSUSE's rsh client disables Kerberos checking...what version/distro on your workstation/server?
 
Old 11-30-2010, 05:54 PM   #9
d072330
Member
 
Registered: Nov 2007
Location: USA
Distribution: CentOS 5/6
Posts: 186

Original Poster
Rep: Reputation: 6
Was told by network team via screen shot that the ports are opened.

I am seeing in the messages file this error when the end user tries to connect:

Nov 30 16:49:34 server xinetd[11964]: START: shell pid=12062 from=XXX.XXX.XXX.XXX
Nov 30 16:49:34 server rshd[12062]: rsh denied to Remote_server_username@testedi.XXX.XXXX.com as user_account: Permission denied.
Nov 30 16:49:34 server xinetd[11964]: EXIT: shell status=1 pid=12062 duration=0(sec)

Note user_account and Remote_server_username are different. Don't know if that is where the problem is.
 
Old 12-01-2010, 08:27 AM   #10
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,604

Rep: Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960
Quote:
Originally Posted by d072330 View Post
Was told by network team via screen shot that the ports are opened.

I am seeing in the messages file this error when the end user tries to connect:

Nov 30 16:49:34 server xinetd[11964]: START: shell pid=12062 from=XXX.XXX.XXX.XXX
Nov 30 16:49:34 server rshd[12062]: rsh denied to Remote_server_username@testedi.XXX.XXXX.com as user_account: Permission denied.
Nov 30 16:49:34 server xinetd[11964]: EXIT: shell status=1 pid=12062 duration=0(sec)

Note user_account and Remote_server_username are different. Don't know if that is where the problem is.
Could be. In the version of RSH that I have on openSUSE, I can specify both the host and user name manually. Don't know if your version of RSH can, but it's worth a try. Might want to try rlogin as well, to see if that gives you any more verbose messages.
 
Old 12-02-2010, 10:45 AM   #11
d072330
Member
 
Registered: Nov 2007
Location: USA
Distribution: CentOS 5/6
Posts: 186

Original Poster
Rep: Reputation: 6
Found the problem. The .rhosts file had 100+ entries so it was easy to miss until I organized the list by server/user. Once this was done it was noticed that the user was missing.

Original entry:
test01.XXX.XXX.com User01
test01.XXX.XXX.com

Missing Entry
test01.XXX.XXX.com User02

Problem now is it works sometimes and then does not work other times. It is like the remote machine that is trying to rsh to the server has some sort of cache going on or something, like the session never died off properly and so when they try to rsh again it gives permission denied. They wait 5 minutes and then it works again. No other machine is having this issue using rsh into the server.

Any thoughts LOL?
 
Old 12-02-2010, 02:52 PM   #12
d072330
Member
 
Registered: Nov 2007
Location: USA
Distribution: CentOS 5/6
Posts: 186

Original Poster
Rep: Reputation: 6
Made two changes that seems to have fixed the problem. We will see in a couple of hours or tomorrow if they worked because after some time has passed it seems to stop working.


Latest changes:
made the .rhosts file 644 permissions.
added the test server to the hosts.equiv file in /etc.

Wish me luck with this old a#$ crap.
 
Old 01-14-2011, 03:05 PM   #13
d072330
Member
 
Registered: Nov 2007
Location: USA
Distribution: CentOS 5/6
Posts: 186

Original Poster
Rep: Reputation: 6
I have created a cron job to touch the .rhost file once a night and for some strange reason this is working. If anyone has any ideas on why this works please let me know.

Discovered this when the machine locked my user out. Once I was locked out I edited the file to make sure I was there and thus this updated the timestamp on the file and then I was able to get in using rsh commands.
 
Old 11-08-2012, 10:08 AM   #14
brewquest
LQ Newbie
 
Registered: Nov 2012
Posts: 1

Rep: Reputation: Disabled
I had the same problem getting a permission denied error. I was able to fix this by creating a file /etc/hosts.equiv with all the hostnames and usernames.

Hope this helps!
 
  


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
Rsh command is not working from a domain controller bvlakshmi9 Programming 9 12-30-2009 11:10 PM
cannot access rsh but ssh is working just fine xear Linux - Networking 6 02-19-2009 08:10 AM
logins are not working ---SSH+ pam _winbind srikanthrao_d Linux - Enterprise 0 01-28-2009 02:45 AM
Remote login with RSH not working atulyahigh Linux - Software 2 02-11-2008 04:05 AM
RSH not working... help hardian_97 Linux - Newbie 1 08-08-2005 10:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:19 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
Open Source Consulting | Domain Registration