Borrar filtros
Borrar filtros

SSH Connection from Windows to Linux

125 visualizaciones (últimos 30 días)
Jeffery
Jeffery el 21 de Sept. de 2023
Respondida: Dheeraj el 25 de Sept. de 2023
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!

Respuestas (1)

Dheeraj
Dheeraj el 25 de Sept. de 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!

Categorías

Más información sobre Install Products en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by