RemoteFile[URL["uri"]]
is a symbolic representation of a file on a remote machine.
RemoteFile
RemoteFile[URL["uri"]]
is a symbolic representation of a file on a remote machine.
Details and Options
- RemoteFile["uri"] can also be used.
- In RemoteFile[URL["uri"]] or RemoteFile["uri"], "uri" can be any kind of URI, including scp, sftp, etc.
- RemoteFile supports the following options:
-
Authentication $SSHAuthentication authentication parameters to be used - 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 used 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.
Examples
open all close allBasic Examples (4)
Copy a file from a remote machine using the scp secure protocol:
CopyFile[RemoteFile["scp://host.example.com/tmp/test.m"], "/tmp/test.m"]Copy to a remote file specified as a URL:
CopyFile["/tmp/test.m", RemoteFile[URL["scp://host.example.com/tmp/test.m"]]]Copy a file from a remote machine using sftp:
CopyFile[RemoteFile["sftp://host.example.com/tmp/test.m",
Authentication -> <|"Username" -> "user", "Password" -> password|>], "/tmp/test.m"]Copy remote files directly using different authentication for source and destination machines:
CopyFile[RemoteFile["sftp://host1.example.com/tmp/test.m",
Authentication -> <|"Username" -> "user1", "Password" -> password1|>], RemoteFile["sftp://host2.example.com/tmp/test.m",
Authentication -> <|"Username" -> "user2", "Password" -> password2|>]]Scope (4)
Copy to a remote file using username and password authentication:
CopyFile["/tmp/test.m", RemoteFile["scp://host.example.com/tmp/test.m", Authentication -> <|"Username" -> "user", "Password" -> password|>]]Copy a file from a remote machine using an identity file:
CopyFile[RemoteFile["sftp://host.example.com/tmp/test.m", Authentication -> <|"Username" -> "user", "SSHKey" -> File["/path/.ssh/id_rsa"]|>], "/tmp/test.m"]Read in the content of an identity file:
identity = ReadString["/path/.ssh/id_rsa"];Copy a file from a remote machine using identity file data:
CopyFile[RemoteFile["sftp://host.example.com/tmp/test.m", Authentication -> <|"Username" -> "user", "SSHKey" -> identity|>], "/tmp/test.m"]Without enough information to authenticate, a prompt will appear:
CopyFile[RemoteFile["sftp://host.example.com/tmp/test.m"], "/tmp/test.m"]Options (1)
Authentication (1)
Set a value for $SSHAuthentication:
$SSHAuthentication = <|"Username" -> "user", "SSHKey" -> File["/path/.ssh/id_rsa"]|>Copy a file using the default authentication contained in $SSHAuthentication:
CopyFile[RemoteFile["sftp://host.example.com/tmp/test.m"], "/tmp/test.m"]Related Guides
-
▪
- Files ▪
- File Operations
History
Text
Wolfram Research (2019), RemoteFile, Wolfram Language function, https://reference.wolfram.com/language/ref/RemoteFile.html.
CMS
Wolfram Language. 2019. "RemoteFile." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RemoteFile.html.
APA
Wolfram Language. (2019). RemoteFile. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RemoteFile.html
BibTeX
@misc{reference.wolfram_2026_remotefile, author="Wolfram Research", title="{RemoteFile}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/RemoteFile.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_remotefile, organization={Wolfram Research}, title={RemoteFile}, year={2019}, url={https://reference.wolfram.com/language/ref/RemoteFile.html}, note=[Accessed: 13-June-2026]}