Results 1 to 6 of 6
does anyone know of a php script or even a cgi that will alow one to use ssh through apache? ie pass commands to an unprivlaged user? should be pretty ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-15-2004 #1
PHP ssh app
- 10-17-2004 #2
i havent messed with php in a long time as im a perl guy, however it does implement a system (or the like) function i remember. with that in mind you can do something like this:
$foo = system("ssh user\@host /path/to/command");
this probably isnt valid php code, but it should get you started. this also assumes you have setup passwordless access for the user using ssh keys.
note also that this is generally considered a bad idea as its a huge security hole. its better to write a script to be called from php on the local machine to do this for you and have the command and arguments hardcoded as to avoid possible exploits and call that local script through the system command and return its output.
- 10-18-2004 #3
no doubt, the security problems would be massive with somethign that just passed commands, thats why I was asking if anyone perhaps knew of a collection of scripts or summin that could handle this (like phpbb or squirrelmail) no worries, im not really concerned bout it, was just a thought, just when I get stuck at places with port 22 closed (annoyning as hell) RA might be nice through a web interface over port 80, but w/e.
- 10-18-2004 #4
- 10-18-2004 #5
- 07-26-2007 #6
- Join Date
- Jul 2007
Elegant way to do SSH in PHP
There's a very elegant way, using the ssh2.so module in PHP. A thorough article on how to set this up:
TechBlog - How to: Make SSH connections with PHP
It's got some source code examples as well.