How to establish shh from Matlab (or how to start programm on remote computer by sending the matlab command on Windows)

41 views (last 30 days)
For my experiment I need to send the command from matlab (which is running on windows) to the linux (running on the remote computer).
The first idea was to use putty and to find the way how to send the command from matlab to putty. But I found no solution for this problem.
In matlab community I found ssh2 function which is looking useful. But if I put in the command window
  • ssh2_simple_command('username@name_of_pc','username',passwort','ls -la *ninjas*')
I receive an error “SSH2 could not connect to the ssh2 host - ‘username@name_of_pc'.
I would be very grateful if you could give me an advice, how to solve this problem.
Many thanks in advance

Answers (1)

Rashed Mohammed
Rashed Mohammed on 8 Mar 2021
Hi Inna,
It seems that remote computer is not accessible from your computer. I've tried the command you've mentioned and it worked perfectly fine for me. Please verify whether remote computer is accessible from your computer or not using the command "ping <remote_computer_hostname>". If the previous command doesn't give error, then try SSH'ing using other software such as Putty to check if it is a problem with MATLAB only.
Hope this helps
Rashed Mohammed
Rashed Mohammed on 8 Mar 2021
Thanks for getting back. I have looked at the File Exchange submission's comments section and it seems that others have had a similar issue. One user has posted a workaround which worked for him. Please try the mentioned workaround. If the issue still persists, feel free to contact the author of the submission directly.

Sign in to comment.


Find more on Install Products 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!