...

View Full Version : weird shell script issue



firepages
12-28-2006, 12:45 PM
Hi, I am using PHP to build a string to pass to the OS using exec or system ..
the long and the short of it is that $exec evaluates to ..

$exec = "scp /some/file.txt user@domain.net:/some";

which should scp file.txt to the remote host...
but when I use exec() or system() I get the reply ..

`cp: cannot create regular file `user@domain.net/some/file.txt``

Its as though the 's' in scp is being ignored ? any ideas?

Thompson
12-28-2006, 06:38 PM
This occurs probally because you don't have SCP access on the OS.
Or, you don't have permission to write files in this place. You should check your permissions to this place to write files in it.

In terms of php coding, if you're trying to write files in a remote place, I think you should create the file first and then put the file there using FTP functions. Executing shell commands is generally not recomended because security issues.

Maybe this link can help you...

http://www.nabble.com/Scp---sftp-with-no-shell-access-or-restricted-access-t2625939.html

:thumbsup:

firepages
12-29-2006, 01:25 AM
Hi, I can scp from the command line, I do it all the time .. and I was just writing a wrapper to save typing out all the paths etc and decided to do it in PHP rather than a shell script.

It appears that 'scp' is being converted to 'cp' in which case the error would make sense, but I do not see how or where 'scp' gets changed to 'cp'



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum