Forum Moderators: coopster
I'm running a php script on my apache2 which is actually generating files on the server.
So I want to delete these files again via my ftp client but it says "permission denied" thouth the ftp user has full rights to the folder (let's call it "test) the files are being generated in.
When I look at the file that has to be deleted it says that it's owned by user "nobody" and group "4294967295", while my ftp user is called "wwwftp" and its group is "ftpusers", so I can't delete with wwwftp what "nobody" created.
How can I setup my ftp user "wwwftp" that it has complete rights under the folder "test"? No matter which user creates files?
Back when I was having the problem, I tried a few experiments with PHP "chmod" and setting permissions from FTP, nothing worked.
But be thankful it works like that. It's a security thing. It's Good.
a couple of options:
1) Get the server administrator (a.k.a. superuser) to delete the files for you.
2) do just as I mention above - use PHP to delete the files. Make yourself a little script that uses unlink().
$uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir . $_FILES['userfile']['name'];
if (@move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
print "File is valid, and was successfully uploaded. ";
@chmod($uploadfile, 0644);
}
but my problem is that i use these functions in php:
fopen()
fwrite()
copy
rename
after that, I can't delete them via ftp.
when I use move_uploaded_file() it works but that's not the thing I wanted to achieve since I write files with fwrite on the server itself and do not particularly upload them from a remote location.