[comp.unix.wizards] rsh & tar

drears@pica.army.mil (Dennis G. Rears (FSAC)) (06/01/89)

  I am on a VAX 8600 running ULTRIK 2.0 trying to execute a rsh on a
SUN386i running SUNOS 4.0.1 (hostname drun).  My login name on both 
machines is drears and I have .rhosts configured properly to rlogin/rsh
between machines.

 I am trying to run the following command on the VAX:

tar -cf - .|rsh drun  tar xf -

I get the error message back:

stty:  operation not support on socket

Any ideas on how to accomplish this in a one step command?  "rcp -r"
won't work either.

Dennis

seindal@skinfaxe.diku.dk (Rene' Seindal) (06/02/89)

drears@pica.army.mil (Dennis G. Rears (FSAC)) writes:


#   I am on a VAX 8600 running ULTRIK 2.0 trying to execute a rsh on a
# SUN386i running SUNOS 4.0.1 (hostname drun).  My login name on both 
# machines is drears and I have .rhosts configured properly to rlogin/rsh
# between machines.

#  I am trying to run the following command on the VAX:

# tar -cf - .|rsh drun  tar xf -

# I get the error message back:

# stty:  operation not support on socket

# Any ideas on how to accomplish this in a one step command?  "rcp -r"
# won't work either.

# Dennis

Check you .cshrc for stty commands, and make sure they are only
run for interactive shells.  You can test whether a shell is interactive by
looking at the 'prompt' variable.  If it is set, the shell is interctive,
otherwise it is not.

Rene' Seindal (seindal@diku.dk).

envbvs@epb2.lbl.gov (Brian V. Smith) (06/02/89)

In article <19836@adm.BRL.MIL>, drears@pica.army.mil (Dennis G. Rears (FSAC)) writes:
> 
>   I am on a VAX 8600 running ULTRIK 2.0 trying to execute a rsh on a
> SUN386i running SUNOS 4.0.1 (hostname drun).  My login name on both 
> machines is drears and I have .rhosts configured properly to rlogin/rsh
> between machines.
> 
>  I am trying to run the following command on the VAX:
> 
> tar -cf - .|rsh drun  tar xf -
> 
> I get the error message back:
> 
> stty:  operation not support on socket
> 
> Any ideas on how to accomplish this in a one step command?  "rcp -r"
> won't work either.
> 

Try doing it in the other direction.  In other words:

log into drun and do an rsh command to the vax:

rsh vaxmachinename cd whereever \; tar cf - . | tar xf -
                                ^
                                be sure to put in the '\'

I do this very often to port directories from one machine to another
to retain the symbolic links modify dates on the files.
 
****
The other possibility of the error occuring is that you are doing some "stty"
command in your .cshrc file on the remote host.  This is not allowed in rsh as
there is no tty on whitch to do the command.  Any stty's should be only in the
.login file.
****
_____________________________________
Brian V. Smith    (bvsmith@lbl.gov)
Lawrence Berkeley Laboratory
We don't need no signatures!

chris@mimsy.UUCP (Chris Torek) (06/02/89)

In article <19836@adm.BRL.MIL> drears@pica.army.mil (Dennis G. Rears (FSAC))
writes:
>tar -cf - .|rsh drun  tar xf -
>
>I get the error message back:
>
>stty:  operation not support on socket

You have an `stty' command in your .cshrc.  Remove it (put it in your
.login instead).

Anything that produces output, including error output, in a .cshrc
must NOT be run if $prompt is not set, because `rsh' runs

	<name of login shell> "-c" <command>

to get the command to run---in this case,

	/bin/csh -c "tar xf -"

Csh always reads and executes .cshrc (unless its permissions or owner
are incorrect).  Input, output, and stderr are in this case connected to
a TCP (stream) socket rather than a tty; stty attempts to do as it is
told, fails because the socket does not allow setting tty characteristics,
and prints an error message.  In this case the `tar xf -' should complete
anyway; but rcp (e.g.) will abort.  (rcp runs `/bin/csh -c "rcp -f ..."' or
`/bin/csh -c "rcp -t ..."', if your login shell is csh.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris

stevea@laidbak.UUCP (Steve Alexander) (06/02/89)

In article <19836@adm.BRL.MIL> drears@pica.army.mil (Dennis G. Rears (FSAC)) writes:
>tar -cf - .|rsh drun  tar xf -
>I get the error message back:
>stty:  operation not support on socket

Are you using the C-shell (csh)?  Do you have a stty command in your .cshrc?
If you do, move it to your .login file, and that should fix your problem.

-- 
Steve Alexander, TCP/IP Development | stevea%laidbak@sun.com
Lachman Associates, Inc.            | ...!sun!laidbak!stevea

link@godot.psc.edu (Tom Link) (06/02/89)

In article <19836@adm.BRL.MIL> drears@pica.army.mil (Dennis G. Rears (FSAC)) writes:
>
> I am trying to run the following command on the VAX:
>
>tar -cf - .|rsh drun  tar xf -
>
how about:

tar -cf - . | rsh drun "cat | tar xf -"

the cat will receive the sdin from the rsh and echo thru the pipe.

tom link

guy@auspex.auspex.com (Guy Harris) (06/03/89)

> I am trying to run the following command on the VAX:
>
>tar -cf - .|rsh drun  tar xf -
>
>I get the error message back:
>
>stty:  operation not support on socket

The problem isn't in the command you're running.  You're probably using
the C shell on the 386i (and the VAX), and the problem is almost
certainly in your ".cshrc" on the 386i.  You probably have an 'stty'
command in your '.cshrc', and it's being run even with a non-interactive
C shell. 

Basically, C shells not fired up with the "-f" flag tend to source your
".cshrc" file; this includes the C shell fired up on an "rsh" if your
login shell on the remote machine is the C shell.  Since a C shell fired
up by the "rsh" has a TCP connection as its standard input and output,
"stty" isn't going to work very well, since it acts on the standard
output in the BSD environment ("/usr/bin/stty") and the standard input
in the S5 environment ("/usr/5bin/stty").  The "ioctl" operations in
question are, in fact, not supported on sockets, and TCP connections are
sockets.

Some versions of the "stty" command were rather rude and didn't inform
you of errors in "ioctl" operations.  The SunOS 4.x one does inform you
of those errors.

Fortunately, the fix is simple.  There are, quite possibly, a whole
*bunch* of operations in your ".cshrc" (e.g., "set history=N") that are
simply not worth doing except in in interactive shells.  What you do is
surround them in your ".cshrc" with:

	if ( $?prompt ) then
		operations....
	endif

and, since in a non-interactive shell "prompt" won't be set, the
operations in question will only be done in interactive shells.  The
"stty" in question is one such operation.  (Why, BTW, are you doing it
in your ".cshrc" at all?  Why not just do it in ".login"?)

This actually should be in 1) the "csh" manual page and/or tutorials on
the C shell, and 2) some list of "frequently asked questions".

gwyn@smoke.BRL.MIL (Doug Gwyn) (06/05/89)

In article <627@godot.psc.edu> link@godot.UUCP (Tom Link) writes:
-how about:
-tar -cf - . | rsh drun "cat | tar xf -"
-the cat will receive the sdin from the rsh and echo thru the pipe.

??  On a reasonable system, "cat |" is just an inefficient no-op.