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

Re: Question about creating an SSH session through SSH tunnel


On Thursday 02 April 2015 07:28:11 Caspar Romot wrote:
> Hello,
> 
> So i am trying to set up a system, where i can create an SSH session from my
> work computer to a controller, that is in a local network and connected to
> a server machine with a public IP (accessible via the internet). So for
> example i want to send a file from my work computer to a controller, how
> should i do that? So far i have set up an SSH session from my work computer
> to the server machine and forwarded the connection to the controller using
> the command ssh_channel_open_forward(tunnelChannel, "controllerIP", 22, "",
> 0); Now if i understand correctly i should create a second SSH session from
> the work computer straight to the controller. That should be possible
> because of the tunnel. And then i should be able to send files through this
> second SSH session. Do i understand this correctly?

Did we discuss this on IRC? Cause I explained it to someone already some days 
ago.

In the first ssh session you do

ssh_channel_open_forward(channel, "destination", 22, "", 0);

The you create a socketpair() and use one fd to read from it and write to the 
ssh channel or read from the channel and write to the fd.

You create a second session and pass the second fd from the socketpair via 
ssh_options_set() and then do whatever you have to do ...


It would be great if someone could extend the 

Cheers,


	-- andreas

-- 
Andreas Schneider                   GPG-ID: CC014E3D
www.cryptomilk.org                asn@xxxxxxxxxxxxxx


References:
Question about creating an SSH session through SSH tunnelCaspar Romot <cro@xxxxxx>
Archive administrator: postmaster@lists.cynapses.org