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.
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 $SSHAuthentication authentication parameters for the connection RemoteAuthorizationCaching False whether 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 allBasic Examples (3)
Run a Wolfram script located on the remote host:
RemoteRun["host.example.com", "example.wls"]Append text to a file on the remote host:
RemoteRun["host.example.com", "echo testing >> output.txt"]Check the contents of that file using RemoteRunProcess:
RemoteRunProcess["host.example.com", "cat output.txt"]Run a command that will return an exit code:
RemoteRun["host.example.com", "sh -c 'exit 42'"]Scope (1)
Create a persistent session with RemoteConnect:
remote = RemoteConnect["host.example.com"]Once the session is created, it can be used without having to reconnect:
RemoteRun[remote, "example1.wls"];
RemoteRun[remote, "example2.wls"];
RemoteRun[remote, "example3.wls"]DeleteObject[remote]Options (4)
Authentication (3)
Run a remote command using username and password authentication:
RemoteRun["host.example.com" , "echo testing >> output.txt", Authentication -> <|"Username" -> "user", "Password" -> "xxxxx"|>]Run a remote command using an identity file for authentication:
RemoteRun["host.example.com", "mv file1 file2", Authentication -> <|"Username" -> "user", "SSHKey" -> File["/path/.ssh/id_rsa"]|>]Set a value for $SSHAuthentication:
$SSHAuthentication = <|"Username" -> "user", "Password" -> password|>Now commands can be run using the default authentication contained in $SSHAuthentication:
RemoteRun["host.example.com", "example.wls"]RemoteAuthorizationCaching (1)
Authorize future connections by placing the public key on the remote machine:
RemoteRun["host.example.com", "pwd", RemoteAuthorizationCaching -> True]The user is now authorized to execute commands without authentication:
RemoteRun["host.example.com", "sh -c 'exit 200'"]Possible Issues (1)
RemoteRun prompts for a username and password. If neither is provided, RemoteRun issues a warning message and returns $Failed:
RemoteRun["host.example.com", "example.wls"]If either the username or password is entered incorrectly, RemoteRun issues a warning message and returns $Failed:
RemoteRun["host.example.com", "example.wls"]If a remote machine cannot be found on the network, RemoteRun issues a warning message and returns $Failed:
RemoteRun["host.example.com", "example.wls"]Related Guides
History
Text
Wolfram Research (2018), RemoteRun, Wolfram Language function, https://reference.wolfram.com/language/ref/RemoteRun.html.
CMS
Wolfram Language. 2018. "RemoteRun." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RemoteRun.html.
APA
Wolfram Language. (2018). RemoteRun. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RemoteRun.html
BibTeX
@misc{reference.wolfram_2026_remoterun, author="Wolfram Research", title="{RemoteRun}", year="2018", howpublished="\url{https://reference.wolfram.com/language/ref/RemoteRun.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_remoterun, organization={Wolfram Research}, title={RemoteRun}, year={2018}, url={https://reference.wolfram.com/language/ref/RemoteRun.html}, note=[Accessed: 13-June-2026]}