How do I use libssh as a server?

I am working on a version of a windows server application that talks to a web application. The web application originally ran with a Linux server, and SSH on Linux ran commands on the server. My plan is to build a C ++ server using Qt to receive commands from a web application and process them to make the Windows version that these commands.

So, for example, if the web application originally sent "echo $ HOME" and got the home directory back, I want to receive the same SSH command on my Windows server and then process it so the server is configured for the home directory to be C: \ Example \, then it will send back to C: \ Example \. My goal is to make the same small change for the web application, and instead the Windows server processes Linux SSH commands to execute the Windows equivalent.

I've never worked with libssh before, but from some searching I found it and read that it can be used as an SSH2 server. Basically my question here is how to use libss2 to create a server in my Qt project so that this web application will SSH on and send commands.

If you think there is a better way then libssh please let me know, this is exactly what I found when searching.

UPDATE: I found this server example code. https://github.com/substack/libssh/blob/master/examples/samplesshd-tty.c

To be honest, I am very confused about this. I can probably break it down and figure out what happens after hours of googling and working on the code. But if someone wants to walk me through the main explanation of what is happening at every step, it will be appreciated.

+3


source to share





All Articles