SSH Connection from Windows to Linux
142 views (last 30 days)
Show older comments
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:
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!
0 Comments
Answers (1)
Dheeraj
on 25 Sep 2023
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!
0 Comments
See Also
Categories
Find more on Enterprise Deployment with MATLAB Production Server in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!