SSH Connection from Windows to Linux

142 ビュー (過去 30 日間)
Jeffery
Jeffery 2023 年 9 月 21 日
回答済み: Dheeraj 2023 年 9 月 25 日
Hello, I am inexperienced on how to establish a SSH connection on MATLAB from my PC (Windows) to another server (Linux).
I tried searching online and came across this package:
SSH/SFTP/SCP For Matlab (v2) by David Freedman
I tried myself to establish it but still with no success.
Error:
Error using ssh2_main
Error: SSH2 could not connect to the ssh2 host - "hostname"!
Error in ssh2 (line 84)
ssh2_struct = ssh2_main(ssh2_struct);
Error in ssh2_command (line 31)
ssh2_struct = ssh2(ssh2_struct);
Error in ssh2_simple_command (line 40)
[ssh2_struct, command_result] = ssh2_command(ssh2_struct, command, enableprint);
Error in ssh (line 5)
command_output = ssh2_simple_command(HOSTNAME,USERNAME,PASSWORD,'ls -la *ninjas*');
Is there anyone that is familiar on how to establish a connection on MATLAB? Thank you very much!

回答 (1 件)

Dheeraj
Dheeraj 2023 年 9 月 25 日
Hi Jeffery,
I understand you want to establish a SSH connection via MATLAB from windows to another server (Linux) and you’re encountering an error using a package. You should have an SSH client installed in your windows machine before trying to use the functions in the package.
If you don’t wish to use a package, you could install a SSH client in your windows machine and establish the connection through MATLAB command as below.
system('ssh username@hostname "your-command"');
Replace “username”, “hostname”, and "your-command" with your specific information and the command you want to run on the remote server.
Remember to establish a connection first through SSH-key or password before attempting the command in MATLAB.
Hope this helps!

カテゴリ

Help Center および File ExchangeEnterprise Deployment with MATLAB Production Server についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by