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

Re: Executing command over forwarded port


On Thursday 16 July 2015 12:07:06 Raghaw Shukla wrote:
> In point C the new session should be from local PC to Remote PC?

Here is a step by step description how I would implement it.

a) Create a ssh session and connect
b) Create a forward channel
c) Create a socketpair()
d) One end of the socketpair() is used to read data and write it to the
   forward channel, and vice versa.
e) Create a new ssh session
f) Set the other fd of the socketpair() as the fd for the new session
g) Connect and exec ...

It should work just fine with a socketpair() but you can also create a tcp 
socket and connect to the port on localhost. I suggest you read the SSH RFC to 
understand port forwarding better and read the manpages about sockets and 
socketpair.

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


Follow-Ups:
Re: Executing command over forwarded portRaghaw Shukla <raghaw.wesee@xxxxxxxxx>
References:
Executing command over forwarded portRaghaw Shukla <raghaw.wesee@xxxxxxxxx>
Re: Executing command over forwarded portAndreas Schneider <asn@xxxxxxxxxxxxxx>
Re: Executing command over forwarded portRaghaw Shukla <raghaw.wesee@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org