My Project is to Create a little Remote Shell for my Home Unix PC in C / C++. Its components are a server which sends commands to the client via socket connection, which executes the command and sends the output.
Now I would like to execute commands like "login" to authenticate myself on the client. Is there any way how to handle interactive commands like "login", "python3" - Python3 Shell ???
I've tried to handle this issue with PIPES, so to pipe(), fork() the Process and catch {STDIN; STDOUT; STDERR}, but I couldn't interact with interactive commands, since they block until they are finished. I just managed to execute "normal" commands like "ls", "arp -a", "ifconfig"... .
Any Ideas, Websites, Code Snippets, Suggestions ???
I appreciate your support, Regards, from David
You do this using so called pseudo terminals. The portable function for that is posix_openpt