Re: running SSH through a PHP script

From: Date: Fri, 18 Jul 2003 15:45:08 +0000
Subject: Re: running SSH through a PHP script
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-155790@lists.php.net to get a copy of this message
On Fri, Jul 18, 2003 at 11:29:50AM -0400, James_Martin@ao.uscourts.gov wrote: > There is no delay in the SSH commands when run from a shell, only > through the web page. Any ideas? What user is running the ssh commands? Does that user have a home directory to which it has write permissions in order to create a ~/.ssh/ directory in which to store host keys? The ssh key negotiation will always take a certain amount of time. If all three ssh commands are to the same remote host, you should consider stringing them together on a single command line, so that you only have to run ssh once. $result = /usr/bin/ssh user@hostname "cd /some/path/ && ./do_something && ./do_something_else" Note: this is one of those cases where you should be ULTRA careful about user input. If your ssh command includes any variables that have been posted in a form, do extensive format checks on them. Usernames should always match ^[a-z0-9]+$ . Nothing being used in the ssh command should be allowed to have [;&|] in it. Be so anal and paranoid that you risk compromising functionality, and you're less likely to screw yourself. -- Paul Chvostek <paul@it.ca> it.canada http://www.it.ca/ Free PHP web hosting! http://www.it.ca/web/

« previous php.general (#155790) next »