Subject: Re: using rsh: "stty: TIOCGETD: Operation not supported"
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
From: Jeremy C. Reed <reed@reedmedia.net>
List: netbsd-help
Date: 04/20/2001 10:59:52
On Fri, 20 Apr 2001, Manuel Bouyer wrote:

> try:
> rsh reed@localhost echo '$$'

rainier:/usr/src/usr.bin/rlogin$ rsh reed@localhost echo '$$'
4770
rainier:/usr/src/usr.bin/rlogin$ echo $$
4638
$ rsh reed@localhost "ps auxwww | grep `echo '$$'`"
reed 4776  0.0  0.5   452   612 p9 S+   10:37AM  0:00.01 bash -c ps auxwww
| grep $$ 
reed 4779  0.0  0.3   164   376 p9 S+   10:37AM  0:00.01 grep 4776

Okay it is running a new shell.

> > I need to look at the code, because I don't understand. (I do know that no
> > r services are listening.)
> 
> rshd is started from inetd. did you check inetd.conf ?

$ egrep 'shell|rshd' /etc/inetd.conf
#shell          stream  tcp     nowait  root    /usr/libexec/rshd rshd -L
#kshell         stream  tcp     nowait  root    /usr/libexec/rshd rshd -k

I am not sure how or why it is running a command. I have never used r
services.

Also, as I showed in my other examples, it won't run if I use 127.0.0.1
or the local host's real name:

 $ time rsh -d reed@127.0.0.1 "ps auxwww | grep `echo '$$'`"
 (null): Connection refused

 real    0m31.059s
 user    0m0.010s
 sys     0m0.001s
 $ time rsh -d reed@rainier "ps auxwww | grep `echo '$$'`"
 rainier: Connection refused

 real    0m31.067s
 user    0m0.001s
 sys     0m0.010s

I don't have any .rhosts; my /etc/hosts.equiv has a "-" dash (which I
didn't see documented in the rhosts manual page).

And, if I use ssh it prompts for password:

$ ssh reed@localhost "ps auxwww | grep `echo '$$'`"
reed@localhost's password: 
reed 4807  0.0  0.5   452   616 ?? Ss   10:43AM  0:00.01 bash -c ps auxwww
| grep $$ 
reed 4809  0.0  0.0   452     4 ?? R    10:43AM  0:00.00 grep 4807 (bash)
$ echo $$
4638


   Jeremy C. Reed
   http://www.reedmedia.net/