I have tried PHP's ftp_site($ftpStream, 'chgrp nobody '.$directory) but I cannot get it to work. Does anyone out there have any success changing a directories group via ftp_connect() in PHP? Thanks.
Asked
Active
Viewed 820 times
0
-
Shouldn't that be on stackoverflow ? – Dominik Mar 10 '10 at 17:59
-
Are you able to manually issue a chgrp command while connected to the ftp server via a CLI client? Does the user you are connect as have permissions to do this? Does the ftp server even support chgrp? – Zoredache Mar 10 '10 at 18:01
-
@Dominik, not necessarily. The issue could be related to the configuration or type of ftp server. – Zoredache Mar 10 '10 at 18:04
-
Yes I can issue the chgrp command via telnet session. Here is what appears in my error log file: PHP Warning: ftp_site() [function.ftp-site]: SITE chgrp is an unknown extension in /usr/www/php/chgrp.php on line 22 – H. Ferrence Mar 10 '10 at 18:23
-
P.S. I can ultimately achieve what I need by chmod-ing the directory to 0777 but I do not want to do that. For security purposes, I want to change the group on the dir to nobody while not opening up the directory to the world. – H. Ferrence Mar 10 '10 at 18:27
-
ftp is NOT telnet, FTP has a very limited set of commands that and what is supported depends on the FTP server. I mean run a command line FTP client and try running your commands (please update your question with the results). – Zoredache Mar 10 '10 at 18:29
2 Answers
1
This is not actually a php issue, but an ftp server issue. You stated in a comment, the php error log contained:
Warning: ftp_site() [function.ftp-site]: SITE chgrp is an unknown extension in /usr/www/php/chgrp.php on line 22
This simply means that the ftp server does not support the CHGRP command. If you try a desktop ftp application, or ftp from the command line, you should receive the same error back from the ftp server when trying to change the group.
Since you have access to the server, why not just chgrp the directory from the command line?
chgrp <path> <groupname>

h0tw1r3
- 2,776
- 19
- 17
-
..."why not just chgrp the directory from the command line" because the app I am writing is dynamic and runs from the browser. I do not want the app to be impeded by me manually needing to (a) get some sort of notification that I need to CHGRP and (b) then manually telnet in to do it. Thanks for the response though. – H. Ferrence Mar 12 '10 at 12:51
0
Let me ask this...
If I use a Deny from all directive on this directory, yet set its permissions to 0757 (drwxr-xrwx) is that too dangerous?

H. Ferrence
- 533
- 3
- 10
- 18