HP-UX Reference (11i v1 05/09) - 1 User Commands N-Z (vol 2)
r
remsh(1) remsh(1)
NAME
remsh, rexec - execute from a remote shell
SYNOPSIS
remsh host [-l username ][-n
] command
host [
-l username ][-n
] command
rexec 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 understood by
gethostbyname()
(see gethostent(3N) and hosts(4)).
remsh copies its standard input (stdin) to the remote command, and 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:
/usr/bin:/usr/ccs/bin:/usr/bin/X11:/usr/contrib/bin:/usr/local/bin
remsh
uses the default remote login shell with the -c option to execute the remote command. If the
default remote shell is csh, csh sources the remote .cshrc file before the command. remsh
cannot be
used to run commands that require a terminal interface (such as
vi) or commands that read their standard
error (such as more). In such cases, use rlogin or telnet instead (see rlogin(1) and telnet(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 on the remote host are
/etc/hosts.equiv
and $HOME/.rhosts (see remshd(1M)).
If command, is not specified, instead of executing a single command, you will be logged in on the remote
host using
rlogin (see rlogin(1)). Any rlogin options typed in on the command line are transmitted to
rlogin.Ifcommand is specified, 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 standard input to
remsh from /dev/null . This is useful when running a shell script containing a remsh command, since
otherwise remsh may use input not intended for it. The
-n option is also useful when running
remsh in
the background from a job control shell,
/usr/bin/csh or /usr/bin/ksh . Otherwise, remsh stops
and waits for input from the terminal keyboard for the remote command. /usr/bin/sh automatically
redirects its input from /dev/null when jobs are run in the background.
Host names for remote hosts can also be commands (linked to remsh) in the directory /usr/hosts
.If
this directory is specified in the
$PATH environment variable, you can omit remsh. 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, the command
remotehost command
executes command on remotehost , and the command
remotehost
is equivalent to
rlogin remotehost
The rexec command works the same as remsh except that it uses the rexec() library routine and
rexecd for command execution (see rexec(3N) and rexecd(1M)) and does not support Kerberos authentica-
tion. rexec prompts for a password before executing the command instead of using hosts.equiv for
authentication. It should be used in instances where a password to a remote account is known but there
are insufficient permissions for remsh.
HP-UX 11i Version 1: September 2005 − 1 − Hewlett-Packard Company Section 1−−829