필터 지우기
필터 지우기

Problem using SSH connection within Matlab

조회 수: 7 (최근 30일)
Léon
Léon 2013년 7월 12일
Hello,
I want to establish a SSH connection to a server and execute several commands there and I want to do that from within Matlab.
My current problem is that the connection can be established but the terminal output is written to the comand window and Matlab waits for my input. Unfortunately I do not want to trigger the commands by hand but automatically.
I tried the direct way first:
unix('ssh root@100.200.300','-echo');
unix('who');
But that evoked the problem as described. So I tried to be clever and write a shell script that does the job and just trigger that script:
script = fopen('/users/leon/documents/MATLAB/script.sh','w');
fprintf(script,'#!/bin/sh \n\n ssh root@100.200.300 ''\n who && \n exit;''');
script = fclose(script);
unix('cd /users/leon/documents/MATLAB/','-echo');
unix('chmod 777 script.sh','-echo');
unix('./script.sh');
But that yields the same result. Anybody an idea? Help is greatly appreciated!
THX

답변 (1개)

Léon
Léon 2013년 7월 15일
no one any idea?

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by