Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

The 'rsh' command always takes 30 seconds

151 views
Skip to first unread message

Ramon F Herrera

unread,
Jul 14, 2009, 1:53:57 PM7/14/09
to

Hello,

I am writing a client-server system. As customary, the clients side is
on Windows XP and the server on Linux. Since the server program run
fast, and the protocol used is the well-known Berkeley remote shell,
the following is a very good approximation:

C:\> rsh hostname date

Much to my dismay, the above command takes -consistently- 30 seconds
to execute. This sounds like some sort of "tar pit" behind the scenes.

From Linux to Linux, the command takes 1 second.

How can I investigate exactly what is going on?

Any suggestion to accelerate my app is greatly appreciated.

TIA,

-Ramon

Vincent Fatica

unread,
Jul 14, 2009, 2:15:24 PM7/14/09
to
The consistent 30 seconds suggests a time-out. You can examime the network
activity by sniffing with with Microsoft Network Monitor (NetMon) or the
WinDump/WinPCap combination (www.winpcap.org).

On Tue, 14 Jul 2009 10:53:57 -0700 (PDT), Ramon F Herrera <ra...@conexus.net>
wrote:

--
- Vince

Allen Kistler

unread,
Jul 14, 2009, 3:27:15 PM7/14/09
to
Ramon F Herrera wrote:
> I am writing a client-server system. As customary, the clients side is
> on Windows XP and the server on Linux. Since the server program run
> fast, and the protocol used is the well-known Berkeley remote shell,
> the following is a very good approximation:
>
> C:\> rsh hostname date
>
> Much to my dismay, the above command takes -consistently- 30 seconds
> to execute. This sounds like some sort of "tar pit" behind the scenes.

If it was a tar pit, the connection would take infinity seconds to
complete, not 30. It's more likely to be DNS or ident.

> From Linux to Linux, the command takes 1 second.
>
> How can I investigate exactly what is going on?

Look in the server logs; run tcpdump on the server; etc.

Chris Davies

unread,
Jul 14, 2009, 4:07:36 PM7/14/09
to
Ramon F Herrera <ra...@conexus.net> wrote:
> I am writing a client-server system. As customary, the clients side is
> on Windows XP and the server on Linux. Since the server program run
> fast, and the protocol used is the well-known Berkeley remote shell,

Using rsh is probably a /really/ bad idea. I cannot recommend strongly
enough that you revisit your architectural security analysis (i.e. start
over). Rsh is insecure. Very insecure. Mind-blowingly insecure.


> the following is a very good approximation:
> C:\> rsh hostname date

> the above command takes -consistently- 30 seconds to execute. [...]


> From Linux to Linux, the command takes 1 second.
> How can I investigate exactly what is going on?

Well, if you want to investigate, I suppose you could run strace on the
rsh server and see whether you can determine which calls are blocking.


> Any suggestion to accelerate my app is greatly appreciated.

This sounds very much to me like a typical reverse IP address lookup
is failing. Put more simply, the IP address of your Windows XP client
cannot be resolved to a name by your Linux server, whereas the IP address
of your Linux client can be.

Chris

Joe Pfeiffer

unread,
Jul 14, 2009, 4:36:31 PM7/14/09
to

I'd probably start by watching the traffic with wireshark (the earlier
suggestions to use strace, and to not use rsh, are also both good).

Ramon F Herrera

unread,
Jul 14, 2009, 5:13:34 PM7/14/09
to

I forgot to add this: YES, I am fully aware of the rsh issues. This is
a quick prototype, and both the client and the server are being
modified to use ssh. At the time the client was written, ssh was not
available. Currently, the Windows rsh vendor does not support rsh
anymore, which is good. Both the client and the server are in my SOHO.

Thanks for the recommendation, it is always good to remind people to
use secure protocols.

-Ramon

Unruh

unread,
Jul 14, 2009, 6:03:56 PM7/14/09
to
Ramon F Herrera <ra...@conexus.net> writes:


>Hello,

>I am writing a client-server system. As customary, the clients side is
>on Windows XP and the server on Linux. Since the server program run
>fast, and the protocol used is the well-known Berkeley remote shell,
>the following is a very good approximation:

>C:\> rsh hostname date

>Much to my dismay, the above command takes -consistently- 30 seconds
>to execute. This sounds like some sort of "tar pit" behind the scenes.

rsh is a bad protocol to use these days. It is very insecure. But it
sounds to me like dns problems-- ie your system is trying to lookup
hostname in the dns and is timing out on its first nameserver.
Try doing
rsh 111.222.333.444 date
where the number is the ip address of hostname, and see if that goes
faster. If it does, you know you have dns problems. If not, it is
something else (look in the /var/log/messages or /var/log/syslog for
hints as to when rsh was started.)

Ramon F Herrera

unread,
Jul 14, 2009, 10:18:05 PM7/14/09
to
On Jul 14, 3:27 pm, Allen Kistler <ackist...@oohay.moc> wrote:
> Ramon F Herrera wrote:
> > I am writing a client-server system. As customary, the clients side is
> > on Windows XP and the server on Linux. Since the server program run
> > fast, and the protocol used is the well-known Berkeley remote shell,
> > the following is a very good approximation:
>
> > C:\> rsh hostname date
>
> > Much to my dismay, the above command takes -consistently- 30 seconds
> > to execute. This sounds like some sort of "tar pit" behind the scenes.
>

> If it was a tar pit, the connection would take infinity
> seconds to complete, not 30.  It's more likely to be
> DNS or ident.

The packet capture contains several 'ident' lines. First time I hear
about it.

-Ramon


Ramon F Herrera

unread,
Jul 15, 2009, 12:01:49 AM7/15/09
to
On Jul 14, 1:53 pm, Ramon F Herrera <ra...@conexus.net> wrote:

Hello again,

Apparently, in order for my session to proceed faster, I need one of
these two solutions, both implemented on the Windows (client) side:

(1) I run an 'ident' server on port 113

(2) I modify/configure the Windows TCP/IP stack to return RST (Reset)
as soon as it receives the ident request from the server.

Any suggestions on how to achieve any of the two solutions?

TIA,

-Ramon

Allen Kistler

unread,
Jul 15, 2009, 12:14:37 AM7/15/09
to

So somewhere in the rsh config there's a line to log the remote user ID.
rsh tries for 30 sec to get the user ID out of Windows, but never
does, so then it continues. Your Linux client is either running identd
or sending back error packets, OTOH, so there's no delay. I don't use
rsh, so you'll need to track the config down without my advice.

Personally I disable identd, but some servers require it (usually IRC).
Most servers just desire it and move on when it's not provided.

Dee Earley

unread,
Jul 15, 2009, 5:09:00 AM7/15/09
to
On 15/07/2009 05:01, Ramon F Herrera wrote:
> Apparently, in order for my session to proceed faster, I need one of
> these two solutions, both implemented on the Windows (client) side:
>
> (1) I run an 'ident' server on port 113
>
> (2) I modify/configure the Windows TCP/IP stack to return RST (Reset)
> as soon as it receives the ident request from the server.
>
> Any suggestions on how to achieve any of the two solutions?

IIRC, windows rejects connections by default (rather than dropping them)
I'm not 100% sure though.
If not, you could add an exception for the ident port which should then
cause the firewall to allow it, and then be rejected as nothing is
listening.

--
Dee Earley (dee.e...@icode.co.uk)
i-Catcher Development Team

iCode Systems

Ramon F Herrera

unread,
Jul 15, 2009, 8:30:38 AM7/15/09
to
On Jul 15, 5:09 am, Dee Earley <dee.ear...@icode.co.uk> wrote:
> On 15/07/2009 05:01, Ramon F Herrera wrote:
>
> > Apparently, in order for my session to proceed faster, I need one of
> > these two solutions, both implemented on the Windows (client) side:
>
> > (1) I run an 'ident' server on port 113
>
> > (2) I modify/configure the Windows TCP/IP stack to return RST (Reset)
> > as soon as it receives the ident request from the server.
>
> > Any suggestions on how to achieve any of the two solutions?
>
> IIRC, windows rejects connections by default (rather than dropping them)
> I'm not 100% sure though.


> If not, you could add an exception for the ident port which
> should then cause the firewall to allow it, and then be rejected
> as nothing is listening.

That is exactly what is happening, Dee. The connection is reject -
after 30 seconds and 4 packets- because nothing is listening. See
here:

http://patriot.net/~ramon/misc/rsh-packet-capture.png

I am trying to prevent the 30 second delay.

There is no firewall, BTW, it is a VPN tunnel which nothing blocked.

-Ramon

Chris Davies

unread,
Jul 15, 2009, 9:03:44 AM7/15/09
to
Dee Earley <dee.e...@icode.co.uk> wrote:
> IIRC, windows rejects connections by default (rather than dropping them)
> I'm not 100% sure though.

The TCP/IP stack will reject them. The default firewall drops them.


> If not, you could add an exception for the ident port which should then
> cause the firewall to allow it, and then be rejected as nothing is
> listening.

This could work, yes.
Chris

Dee Earley

unread,
Jul 15, 2009, 9:47:53 AM7/15/09
to

No it's not, the incoming connections are being dropped, meaning there
is a firewall on that machine (or you have a broken ident server running)
As they are being dropped, there is NO reply to the rsh server so the
only option it has is to wait for a timeout.

To get around this, it MUST be rejected (with a connect failure) by the
firewall or accepted by an application and dealt with.
you should be able to add an exception to the windows firewall for that
port, meaning it then gets rejected rather then silently dropped.

Ramon F Herrera

unread,
Jul 15, 2009, 10:11:22 AM7/15/09
to
> Dee Earley (dee.ear...@icode.co.uk)

> i-Catcher Development Team
>
> iCode Systems

You are absolutely right, Dee. I added the TCP port 113 to the Windows
FW and now things are working.

Thanks!

-Ramon

Maxwell Lol

unread,
Jul 15, 2009, 2:50:00 PM7/15/09
to
Dee Earley <dee.e...@icode.co.uk> writes:

> To get around this, it MUST be rejected (with a connect failure) by
> the firewall or accepted by an application and dealt with.
> you should be able to add an exception to the windows firewall for
> that port, meaning it then gets rejected rather then silently dropped.

or disable the ident request on the Linux client. (This seems like
the easiest solution. Either it's a config issue, or you install ssh,
and rename it rsh, at worst you install a new version from source.)

Some tips here:


http://www.starnet.com/xwin32kb/rsh_or_rexec_sessions_take_a_long_time_to_login/

Ramon F Herrera

unread,
Jul 15, 2009, 5:09:21 PM7/15/09
to
On Jul 15, 2:50 pm, Maxwell Lol <nos...@com.invalid> wrote:

> Dee Earley <dee.ear...@icode.co.uk> writes:
> > To get around this, it MUST be rejected (with a connect failure) by
> > the firewall or accepted by an application and dealt with.
> > you should be able to add an exception to the windows firewall for
> > that port, meaning it then gets rejected rather then silently dropped.
>

> or disable the ident request on the Linux server.
> (This seems like the easiest solution).

I tried that too, and it is indeed another solution. See below.

The moral of the story is what I have been told repeatedly, and I
concur: Stay away from RSH. Use SSH.

-Ramon The OP

----------------

% 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 <== Change to HOST
log_on_failure += USERID <== Change to HOST
server = /usr/sbin/in.rshd
disable = no
}

Man-wai Chang to The Door (+MS=V32B)

unread,
Jul 16, 2009, 9:22:27 AM7/16/09
to
> C:\> rsh hostname date
>
> Much to my dismay, the above command takes -consistently- 30 seconds
> to execute. This sounds like some sort of "tar pit" behind the scenes.
>
> From Linux to Linux, the command takes 1 second.
>
> How can I investigate exactly what is going on?

Reverse DNS lookup? Ident lookup?

--
@~@ Might, Courage, Vision, SINCERITY.
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 9.04) Linux 2.6.30.1
^ ^ 21:22:01 up 5 days 5:51 1 user load average: 1.35 1.66 1.51
???! ???! ???! ???! ???! ???! ????? (CSSA):
http://www.swd.gov.hk/tc/index/site_pubsvc/page_socsecu/sub_addressesa

0 new messages