RemoteConnect["host"]
指定されたリモートホストに接続する.
RemoteConnect[IPAddress["address"]]
指定されたIPアドレスのマシンに接続する.
RemoteConnect["host",username]
指定されたユーザ名を使ってリモートホストに接続する.
RemoteConnect["host",username,password]
指定されたユーザ名とパスワードを使って接続する.
RemoteConnect
RemoteConnect["host"]
指定されたリモートホストに接続する.
RemoteConnect[IPAddress["address"]]
指定されたIPアドレスのマシンに接続する.
RemoteConnect["host",username]
指定されたユーザ名を使ってリモートホストに接続する.
RemoteConnect["host",username,password]
指定されたユーザ名とパスワードを使って接続する.
詳細とオプション
- RemoteConnectはRemoteConnectionObjectを返す.
- RemoteConnect["host"]はユーザ名とパスワードを要求する.
- RemoteConnect["user@host"]はパスワードのみを要求する.
- RemoteConnect["user@host",password]を使ってユーザ名とパスワードの両方が指定できる.
- RemoteConnectは,認証に際して可能であればSSHエージェントを使用する.
- RemoteConnectには次のオプションを使うことができる.
-
Authentication $SSHAuthentication 接続のための認証パラメータ RemoteAuthorizationCaching False リモート認証キャッシュを使うかどうか - Authentication->assoc の形式における連想 assoc は,次の鍵を含むことができる.
-
"Username" 認証に使用するユーザ名 "Password" 認証に使用するパスワード "SSHKey" SSH ID "SSHKeyPassword" SSHKeyの復号化に使用するパスフレーズ文字列 - SSH IDは"SSHKey"->File[ident]の形で与えることができる.この中の ident はSSH秘密鍵を含むファイルである.SSH IDは"SSHKey"->"string"で与えることもできる.ここの"string"はSSH秘密鍵である.
- RemoteConnect["host",username,password]はRemoteConnect["host",Authentication-><|"Username"->username,"Password"->password|>]に等しい.
- RemoteAuthorizationCaching->Trueの設定のとき,RemoteConnectは,パスワードなしの接続が可能になるように認証情報をリモートでキャッシュする.
例題
すべて開く すべて閉じる例 (1)
remote = RemoteConnect["host.example.com"]RemoteRunProcess[remote, "uptime", "StandardOutput"]RemoteRunProcess[remote, "pwd", "StandardOutput"]
RemoteRunProcess[remote, "cd ..", "StandardOutput"]
RemoteRunProcess[remote, "pwd", "StandardOutput"]WriteLine[remote, "pwd"]ReadString[remote]DeleteObject[remote]スコープ (1)
オプション (4)
Authentication (3)
Authenticationオプションを使ってユーザ名および/またはパスワードを与える:
remote = RemoteConnect["host.example.com", Authentication -> <|"Username" -> "username", "Password" -> password|>]RemoteConnect["host.example.com" , Authentication -> <|"Username" -> "user", "SSHKey" -> File["/path/.ssh/id_rsa"]|>]$SSHAuthenticationの値を保存する:
$SSHAuthentication = <|"Username" -> "user", "Password" -> password|>$SSHAuthenticationに含まれるデフォルトの認証を使って接続する:
RemoteConnect["host.example.com"]RemoteAuthorizationCaching (1)
RemoteAuthorizationCachingオプションを使って公開鍵をリモートホストに保存する:
remote = RemoteConnect["host.example.com", RemoteAuthorizationCaching -> True]DeleteObject[remote]remote = RemoteConnect["host.example.com"]DeleteObject[remote]おもしろい例題 (1)
remote = RemoteConnect["host.example.com"]リモートマシン上でwolframscriptを使って評価を実行する関数を定義する:
Attributes[RemoteWolframScript] = {HoldAllComplete};RemoteWolframScript[remote_, expr_] := Module[{compressed},
compressed = ExportString[ToString[Hold[expr], InputForm], "Base64"];
ToExpression[RemoteRunProcess[remote, "wolframscript -format InputForm -code 'ReleaseHold[ImportString[\"" <> compressed <> "\",\"Base64\"]]'", "StandardOutput"]]]ローカルとリモートの両方で$MachineNameを評価する:
{$MachineName, RemoteWolframScript[remote, $MachineName]}ローカルとリモートの両方で$MachineIDを評価する:
{$MachineID, RemoteWolframScript[remote, $MachineID]}DeleteObject[remote]関連するガイド
テキスト
Wolfram Research (2018), RemoteConnect, Wolfram言語関数, https://reference.wolfram.com/language/ref/RemoteConnect.html.
CMS
Wolfram Language. 2018. "RemoteConnect." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RemoteConnect.html.
APA
Wolfram Language. (2018). RemoteConnect. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RemoteConnect.html
BibTeX
@misc{reference.wolfram_2026_remoteconnect, author="Wolfram Research", title="{RemoteConnect}", year="2018", howpublished="\url{https://reference.wolfram.com/language/ref/RemoteConnect.html}", note=[Accessed: 16-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_remoteconnect, organization={Wolfram Research}, title={RemoteConnect}, year={2018}, url={https://reference.wolfram.com/language/ref/RemoteConnect.html}, note=[Accessed: 16-November-2026]}