I've been trying to execute two or more commands on a remote device by using PHP's ssh2_exec command but it doesn't seem to be able to execute a command, wait for a response and execute another one.
The second command that I need to run must be in the context of the first command so it must be executed in the same shell. What I mean is something like this
FWEFW # config system admin
This command will take me into a "context". The result will be something like:
FWEFW (admin) #
From here, I'd like to run a second command that could set the password or another field of (admin)
FWEFW (admin) # set password 'abcde'
Here's what I've tried so far:
$stream = ssh2_exec($con, 'config system admin');
stream_set_blocking($stream, TRUE);
$output = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO);
// After this, what can I do to stay in the same shell and execute the second command after "config system admin"?