maximt
April 2, 2013, 6:51am
1
i have simple php script to upload configs to my routers by ssh2
script working fine with all my unix servers, but not with mikrotik (5.24 x86, mipsbe)
$conn = ssh2_connect( '10.10.10.1', 22 );
issh2_auth_password($conn, 'admin', '123');
ssh2_scp_send($conn , '/home/ftp/mt/my.cfg', 'my.cfg');
after running script i got empty file with incorrect filename
/file> print detail
2 name="'my.cfg';oYLbU" type=".cfg';oYLbU file" size=0 creation-time=apr/02/2013 12:49:36
contents=""
3 name="'my.cfg'`cZ%" type=".cfg'`cZ% file" size=0 creation-time=apr/02/2013 12:49:37
contents=""
4 name="'my.cfg'MZq$A" type=".cfg'MZq$A file" size=0 creation-time=apr/02/2013 12:49:39
contents=""
5 name="'my.cfg'3;" type=".cfg'3; file" size=0 creation-time=apr/02/2013 12:49:40 contents=""
6 name="'my.cfg'P*tp" type=".cfg'P*tp file" size=0 creation-time=apr/02/2013 12:47:09
contents=""
as i see name of my file is rounded by ' , probably MT expected to see there a " instead ’
libssh2 version 1.2.2
janisk
April 2, 2013, 11:19am
2
can you try this php stuff on 6.0rc12?
maximt
April 3, 2013, 8:59am
3
6.0rc12 x86
same script, same result
/file print detail
0 name="skins" type="directory" creation-time=apr/03/2013 15:46:48
1 name="'my.cfg'_j" type=".cfg'_j file" size=0
creation-time=apr/03/2013 15:56:50 contents=""
2 name="'my.cfg'\9{G1;yH" type=".cfg'\9{G1;yH file" size=0
creation-time=apr/03/2013 15:57:04 contents=""
janisk
April 3, 2013, 1:06pm
4
please enable ssh debug logs with about 1000 lines (see wiki.mikrotik.com for details) and attempt your script, create support output file immediately after you have done that and sent to support@mikrotik.com
maximt
April 6, 2013, 8:23am
5
create supout for 6.0rc12 x86, sent to email (and log-file too)
file has been created with name:
name="'my.cfg'to" type=".cfg'to file" size=0 creation-time=apr/06/2013 15:06:06 contents=""
Apr/06/2013 15:06:06 ssh,debug cmd: scp -pt 'my.cfg'to
full log at attachment
log.0.txt (19.3 KB)
janisk
April 8, 2013, 12:57pm
6
php sends wrong length of command. as result it gets parsed differently from expected. Try to use different implementation.
maximt
April 8, 2013, 1:07pm
7
thanks, ssh2_sftp works fine
janisk
April 8, 2013, 1:20pm
8
excelent that you found way around this.