Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ remsh(1) — HP-UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

rlogin(1)

remshd(1M)

hosts.equiv(4)

hosts(4)

REMSH(1)  —  Series 300 and 800 Only

NAME

remsh − execute from a remote shell

SYNOPSIS

remsh host [ −l username ] [ −n ] command
host [ −l username ] [ −n ] command

DESCRIPTION

Remsh connects to the specified host and executes the specified command.  The host name can be either the official name or an alias as listed in /etc/hosts; see hosts(4). Remsh copies its standard input (stdin) to the remote command, the standard output of the remote command to its standard output (stdout), and the standard error of the remote command to its standard error (stderr).  Hangup, interrupt, quit, terminate, and broken pipe signals are propagated to the remote command.  Remsh exits when the sockets associated with stdout and stderr of the remote command are closed.  This means that remsh normally terminates when the remote command does.  (See remshd(1M)).

By default, remsh uses the following path when executing the specified command:

:/bin:/usr/bin:/usr/contrib/bin:/usr/local/bin

Remsh uses your remote login shell with the −c option to execute the remote command.  If your remote shell is csh, your remote .cshrc file is sourced before the command.  You cannot run an interactive command like more(1) or vi(1) with remsh. For those commands, you should use rlogin(1).

The remote account name used is the same as your local account name, unless you specify a different remote name with the −l option.  This remote account name must be equivalent to the originating account; no provision is made for specifying a password with a command.  For more details about “equivalent” hosts and how to specify them, see hosts.equiv(4). The files inspected by remshd(1M) on the remote host are /etc/hosts.equiv and $HOME/.rhosts. 

If you omit command, then instead of executing a single command, you will be logged in on the remote host using rlogin(1). Whatever rlogin options you have typed in the command line will be transmitted to rlogin. If command is specified, then options specific to rlogin are ignored by remsh.

By default, remsh reads its standard input and sends it to the remote command, because remsh has no way to determine whether the remote command requires input.  The −n option redirects the input of remsh from /dev/null.  This is useful when running a shell script containing a remsh command, since otherwise remsh may use up input not intended for it.  The −n option is also useful when running remsh in the background from csh on a job control system (Series 800 only).  Otherwise, remsh stops and waits for tty input for the remote command.  /bin/sh automatically redirects its input from /dev/null when jobs are run in the background. 

Official host names and their aliases are in the file /etc/hosts; see hosts(4). The host names for remote hosts can also be commands (linked to remsh) in the directory /usr/hosts.  If you put this directory in your search path, then the remsh can be omitted. For example, if “remotehost” is the name of a remote host, /usr/hosts/remotehost is linked to remsh, and if /usr/hosts is in your search path, then the command

remotehost command

executes “command” on “remotehost”, and the command

remotehost

is equivalent to

rlogin remotehost

EXAMPLES

Shell metacharacters that are not quoted are interpreted on the local host, while quoted metacharacters are interpreted on the remote host.  Therefore the command line

remsh otherhost cat remotefile >> localfile

appends the remote file remotefile to the local file localfile, while the command line

remsh otherhost cat remotefile ">>" otherremotefile

appends remotefile to the remote file otherremotefile. 

If your remote shell is /bin/sh, the following command line sets up the environment for the remote command before executing the remote command:

remsh otherhost . .profile 2>&- \; command

The “2>&−” throws away error messages generated by executing .profile when stdin and stdout are not a terminal. 

The following command line runs remsh in the background on the local system, and the output of the remote command comes to your terminal asynchronously:

remsh otherhost -n command &

The background remsh will complete when the remote command does. 

The following command line causes remsh to return immediately without waiting for the remote command to complete:

remsh otherhost -n "command 1>&- 2>&- &"

(See remshd(1M) and sh(1)). If your login shell on the remote system is csh, use the following form instead:

remsh otherhost -n "sh -c \"command 1>&- 2>&- &\""

RETURN VALUE

If remsh fails to set up the secondary socket connection, it returns 2.  If it fails in some other way, it returns 1.  If it fully succeeds in setting up a connection with remshd, it returns 0, once the remote command has completed. Note that the return value of remsh bears no relation to the return value of the remote command. 

DIAGNOSTICS

Besides the errors listed below, errors can also be generated by the libraries rcmd and rresvport which are used by remsh (see rcmd(3X)). Those errors are preceded by the name of the library function that generated them. The diagnostic messages for remsh are the following:

rlogin: ... 
Error in executing rlogin (rlogin is executed when the user does not specify any commands to be executed).  This is followed by the error message specifying why the execution failed.

shell/tcp: Unknown service
The “shell” service specification is not present in the /etc/services file. 

Can’t establish stderr
Remsh cannot establish secondary socket connection for stderr. 

<system call>: ... 
Error in executing system call.  Appended to this error is a message specifying the cause of the failure.

There is no entry for you (user ID <uid>) in /etc/passwd
Check with the system administrator to see if your entry in the password file has been deleted by mistake.

WARNINGS

For security reasons, the /etc/hosts.equiv and .rhosts files should exist, even if empty, and should be readable and writable only by the owner.  Note also that all information, including any passwords asked for, is passed unencrypted between the two hosts. 

If remsh is run with an interactive command it will hang. 

DEPENDENCIES

Remsh is the same service as rsh on 4.2BSD.  The name was changed due to a conflict with the existing System V command rsh (restricted shell).  Implemented on the Series 300 and 800 only. 

AUTHOR

UCB (University of California at Berkeley)

FILES

/etc/hosts host name data base

/usr/hosts/* for version of the command invoked only with hostname

SEE ALSO

rlogin(1), remshd(1M), hosts.equiv(4), hosts(4). 

Hewlett-Packard Company  —  May 11, 2021

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026