Scroll to navigation

REMRUN(1) General Commands Manual REMRUN(1)

NAME

remruncopy a file to a remote host and execute it

SYNOPSIS

remrun [-Nsv] [--noop] [--stdin] [--verbose] [-C local_cksum_command] [-c remote_cksum_command] destination filename [args...]

remrun [-V | --version | -h | --help | --features]

DESCRIPTION

The remrun utility copies the specified file to the remote host using SSH under a temporary filename, executes it on the remote side, then removes the temporary file. By default, the remote program does not have access to the current process's standard input stream; the -s option has to be passed explicitly to enable that.

As a special case, if “-” (a single dash) is passed as the filename argument, remrun will read the contents of the standard input, store it into a temporary file, and then copy and execute that file, removing it afterwards. This is incompatible with the -s (--stdin) option.

The remote host to transfer the file to may be specified in two ways: either as a [username@]host pattern, or as a ssh://[username@]host[:port][/] URI.

Note that the sha256sum(1) tool is used both locally and remotely to make sure that the file has been transferred correctly. Its use may be overridden for the local host by the -C option, and for the remote one by the -c option; both commands are passed to the shell, so they may be comprised of more than one word, e.g. “sha256 -r”.

The remrun utility accepts the following command-line options:

Display program usage information and exit.
No-operation mode - do not perform any changes, simply report what would have been done.
Allow the remote program access to the standard input stream. Please note that this will cause some SSH clients to read the whole input stream, regardless of whether the remote program only needs a line or two!
Display program version information and exit.
Verbose mode - display information about the actions performed.

ENVIRONMENT

The operation of the remrun utility is not directly influenced by any environment variables.

FILES

The operation of the remrun utility is not directly influenced by the contents of any files.

EXAMPLES

Copy the whoami.sh file over to the “server” host, logging in as the “jrl” user account, then run it:

remrun jrl@server whoami.sh

Do the same, but for a remote host that runs FreeBSD and another command must be used instead of sha256sum:

remrun -c 'sha256 -r' jrl@server whoami.sh

Specify the commands to run directly:

printf 'uname -a\ndate -R\n' | remrun jrl@server -

DIAGNOSTICS

The remrun utility exits 0 on success, and >0 if an error occurs.

SEE ALSO

mktemp(1), sha256sum(1), ssh(1)

STANDARDS

No standards were harmed during the production of the remrun utility.

HISTORY

The remrun utility was written by Peter Pentchev in 2021.

AUTHORS

Peter Pentchev ⟨roam@ringlet.net⟩

BUGS

No, thank you :) But if you should actually find any, please report them to the author.

March 6, 2022 Debian