필터 지우기
필터 지우기

SSH Connection from Windows to Linux

조회 수: 125 (최근 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 CenterFile Exchange에서 Install Products에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by