[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple non-interactive shell


Hi everybody,
Thanks for your help, but I still can't make it work. Actually, I can't even find a proper ssh_function to send commands to a shell, in non-interactive mode : in the documentation, I can only run one command with request_exec (without an "interactive shell", but can I with a non-interactive one ?) or send the user input to the remote pty.

I'm sorry, I'm not really experimented in programming (in english speaking too).


Aloys D.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
Le jeudi 28 novembre 2019 13:50, <g4-lisz@xxxxxxxxxxxx> a écrit :

> On 28.11.19 09:09, Aloys Delobel wrote:
>
> > Hi,
> > thanks for your help ! However, when I add the while loop (as in the tutorial, the program stops there). Any ideas ? Moreover, I don't really need the result of the remote command for now... (just hope there won't be any errors :) )
>
> I think you also have to investigate a bit on the server side... Maybe
> the remote shell simply gets closed after one command? I really don't
> know it, I've never used more than one remote command in one session.
>
> Good luck,
> Till
>
> > Aloys D.
> > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > Le mardi 26 novembre 2019 11:32, g4-lisz@xxxxxxxxxxxx a écrit :
> >
> > > On 25.11.19 12:04, Aloys Delobel wrote:
> > >
> > > > Hi everybody,
> > > > I'm trying to set a simple non-interactive shell, between my program
> > > > (which sends commands to the remote shell) and the server. Here's my
> > > > program :
> > > > [.....]
> > > > And the problem is : the line "pass_instruction(channel, MV_FILE,
> > > > "example.txt");" works and copy the file, then the
> > > > "pass_instruction(channel, MV_FILE, "example2.txt") ;" works according
> > > > to the program, but the file is not copied. I don't understand why...
> > > > Thanks for helping !
> > > > Aloys D.
> > > > I'm not familiar with libssh and the remote shell... Just some idea:
> > > > Your pass_instruction function only checks if the write to the server
> > > > was successfull, but not the result of the remote command. Can it be
> > > > that remote side waits for a read before it passes the next line to the
> > > > shell?
> > >
> > > The example at http://api.libssh.org/stable/libssh_tutor_shell.html uses
> > > some read/write loop, like
> > > while (ssh_channel_is_open(channel) &&
> > >          !ssh_channel_is_eof(channel))
> > >   {
> > >           read(...);
> > >           ....
> > >           write(...);
> > >   }
> > > Till



Archive administrator: postmaster@lists.cynapses.org