RemoteRun

RemoteRun["host","command"]

runs the specified operating system command on the remote host, returning the exit code obtained.

RemoteRun[IPAddress["address"],"command"]

runs the command on the machine with the specified IP address.

RemoteRun[obj,"command"]

run the command on the remote host specified by the RemoteConnectionObject obj.

Details and Options

  • RemoteRun["host","command"] by default prompts for a username and password.
  • RemoteRun["user@host",] prompts for a password only.
  • RemoteRun will use an ssh-agent for authentication if available.
  • RemoteRun allows the following options:
  • Authentication$SSHAuthenticationauthentication parameters for the connection
    RemoteAuthorizationCachingFalsewhether to use remote authorization caching
  • In the form Authentication->assoc, the association assoc can contain these keys:
  • "Username"username to use for authentication
    "Password"password to use for authentication
    "SSHKey"SSH identity
    "SSHKeyPassword"passphrase string to use to decrypt SSHKey
  • An SSH identity can be given in the form "SSHKey"->File[ident], where ident is a file containing an SSH private key. It can also be given as "SSHKey"->"string", where "string" is an SSH private key.
  • RemoteRun returns the error code of the remote "command".

Examples

open all close all

Basic Examples  (3)

Run a Wolfram script located on the remote host:

In[1]:=
Click for copyable input
Out[1]=

Append text to a file on the remote host:

In[1]:=
Click for copyable input
Out[1]=

Check the contents of that file using RemoteRunProcess:

In[2]:=
Click for copyable input
Out[2]=

Run a command that will return an exit code:

In[1]:=
Click for copyable input
Out[1]=

Scope  (1)

Options  (4)

Possible Issues  (1)

Introduced in 2018
(11.3)