Subject: Re: Remote using command line

Re: Remote using command line

From: Dmitry <>
Date: Wed, 11 Apr 2012 19:04:56 +0400

Ok. I read about channel and session in libssh. So, if i understood
correctly, one channel for one command. And if i change working directory
in one (like send "cd working_directory)", other channel will do not now
about my changes anything. So, if i want to do smth like this:
cd new_dir
tar cf test.tar test.txt
cd old_dir
i must to use the same channel.
But this way leads me to LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED when call
So, what else i don't understand or don't know about libssh. And, maybe, i
try to solve problem, by using wrong way? If so, in what way i can remote
execute shell command in specified (by me) directory?

I would be very grateful for any advice.

2012/4/11 Dmitry <>

> Hi!
> Try to send to remote server command "tar cf test.tar test_file.txt"
> As a result of this operation creates archive test.tar in folder
> /home/username. But I want to be able to execute commands not only in
> /home/username directory, but in any directory. How can I implement this
> feature? Before create archive i tried to send command like "cd /
> target_directory" But as a result archive anyway created in /home/username
> directory.
> Dmitry

Received on 2012-04-11