Creating an SSH connection in a program?

I am writing a program (in C) in which I have to access data from another computer through an SSH connection. I was wondering how to create an SSH connection inside a program.

thank

+3
source share
2 answers

One simple solution would be to use a binary file sshand call it from your program. Create 3 channels using pipe(), then fork(), the close()corresponding endpoints (not necessary if necessary), so you have 2 processes with 3 pipes in between. In the child language, dup2()the pipeline endpoints to stdin, stdout and stderr (i.e., Fd 0, 1, 2) and exec()to the ssh command.

. RSA-, .

, ; -)

+3

libssh. ? ?

, . YMMV.

+1

Source: https://habr.com/ru/post/1755222/


All Articles