I was thinking the other day about making a web based bash interface and I found out about the backtick operator in php that lets you execute a shell script through bash. However I know that http is a stateless protocol and that if you run a shell script you get the response but if it asks for input from you…you can’t really respond because the next time you send anything to the server it won’t be responding but just executing another command.
My question isn’t very specific but I’m wondering if there is a way to somehow keep track of a “session” in bash or other programs. Any news?
P.S. I’m kind of a n00b so see if you can explain things simply…
There are various admin consoles written in PHP that offer a shell. For one example, see Shell Commander. Wikipedia has a page on Web-based SSH.
If doing that, you want to keep the state information in PHP. That is, the PHP script would associate the user with a session (with a cookie) and keep track of that user’s session, holding open an SSH connection or instance of bash and remembering that it is associated with that user. I am actually not sure how to keep such an object around across multiple requests in PHP.