Subject: Re: using rsh: "stty: TIOCGETD: Operation not supported"
To: None <netbsd-help@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: netbsd-help
Date: 04/20/2001 09:11:18
On Fri, 20 Apr 2001, Manuel Bouyer wrote:

> On Thu, Apr 19, 2001 at 05:22:05PM -0700, Jeremy C. Reed wrote:
> > I was playing with rsh and I see that it runs a command locally if it
> > doesn't connect.
> > 
> > I don't use rsh.
> >  Trying 127.0.0.1...
> >  rlogin: rcmd: connect to address ::1
> >  Connection refused

Sorry bad example. No r services are running.

 rainier:~$ rsh localhost
 rlogin: rcmd: connect to address ::1
 Connection refused
 Trying 127.0.0.1...
 rlogin: rcmd: connect to address ::1
 Connection refused
 Trying 127.0.0.1...
 ^C
 rainier:~$ time rsh rainier
 rainier: Connection refused

 real    0m31.062s
 user    0m0.013s
 sys     0m0.005s
 rainier:~$ time rsh 127.0.0.1
 (null): Connection refused

 real    0m31.061s
 user    0m0.014s
 sys     0m0.001s

Why does using localhost different than using rainier or 127.0.0.1?
Is this because it is using IPv6?

> > Here is my example -- it doesn't connect, gives an error, and then
> > executes "ls":
> > 
> > rainier:~$ rsh localhost ls /
> > stty: TIOCGETD: Operation not supported


More examples:

 rainier:~$ time rsh 127.0.0.1 ls -l /netbsd
 (null): Connection refused

 real    0m31.055s
 user    0m0.000s
 sys     0m0.008s
 rainier:~$ time rsh localhost ls -l /netbsd # trying again
 stty: TIOCGETD: Operation not supported
 -rwxr-xr-x  1 root  wheel  2604113 Apr  7 21:30 /netbsd

 real    0m0.038s
 user    0m0.000s
 sys     0m0.003s
 rainier:~$ time rsh rainier ls -l /netbsd               
 rainier: Connection refused

 real    0m31.059s
 user    0m0.000s
 sys     0m0.009s


And more tests ...

 rainier:~$ time rsh reed@localhost whoami        
 stty: TIOCGETD: Operation not supported
 reed

 real    0m0.029s
 user    0m0.000s
 sys     0m0.003s
 rainier:~$ time rsh nonexistent@localhost whoami        
 rcmd: rcmd: connect to address ::1
 Connection refused
 Trying 127.0.0.1...
 rcmd: rcmd: connect to address ::1
 Connection refused
 Trying 127.0.0.1...
 rcmd: rcmd: connect to address ::1
 Connection refused
 Trying 127.0.0.1...
 ^C
 real    0m3.421s
 user    0m0.010s
 sys     0m0.001s
 rainier:~$ time rsh reed@127.0.0.1 whoami
 (null): Connection refused

 real    0m31.058s
 user    0m0.000s
 sys     0m0.009

And one more test ...

 rainier:~$ echo $$
 4465
 rainier:~$ time rsh reed@localhost echo $$
 stty: TIOCGETD: Operation not supported
 4465

 real    0m0.025s
 user    0m0.000s
 sys     0m0.009s

> I suspect you have a stty in your .cshrc.
> You should run it only for interactive shells, e.g. something like:
> if ($?prompt) then
> 	stty foo
> endif
> 
> Actually rsh did connect, and the error message was not from rsh itself
> but from the shell it started to exec the command.

I need to look at the code, because I don't understand. (I do know that no
r services are listening.)

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