Matlab R2015a
Hello,
In order to programmatically ssh connect I made an expect script as explained in
ssh connect and commands programmatically
#!/usr/bin/expect
set login "any_user"
set addr "some_address"
set pw "any_pwd"
spawn ssh -t $login@$addr
expect "$login@$addr\'s password:"
send "$pw\r"
expect "~" ; # put here string from your server prompt
send "mkdir some_dir\r"
interact
I called this script LoginSSH.sh (of course, with my own data), then I run this command in the Linux console without problems:
./LoginSSH.sh
The idea was to run this command from Matlab with system():
scmd='./LoginSSH.sh'
[status,cmdout]=system(scmd)
But for some reason Matlab has some problems to execute the script via system(). This is the output:
status =
1
cmdout =
OpenSSL version mismatch. Built against 100020af, you have 1000107f
send: spawn id exp4 not open
while executing
"send "$pw\r""
(file "./LoginSSH.sh" line 8)
I can even run the command in Python:
import os
from subprocess import call
call(["./LoginSSH.sh"])
again, without any problems.
What could be the reason Matlab won't like to run the shell script?
Thanks in advance.
jleon
env -i ./LoginSSH.shthrough thesystemfunction.env -istarts the given script without inheriting MATLAB's environment. MATLAB sets a lot of variables in the shell before starting (thematlabcommand is a shell script that prepares the environment and then launches the MATLAB binary).env -i ./LoginSSH.shbut it last forever and never returns (until Ctrl-D). If I runssh -Vboth in OS shell and Matlab command it gives different versions for OpenSSL. So I guess Matlab is trying to use a different version of OpenSSL. If I runenv(again, in both sides) to get a list of the different environment variables I don't see something that has to do with it. I just want Matlab to run the same version that is run in the Linux shell. Thanks in advance, jleon