Gossamer Forum
Home : General : Perl Programming :

550 file.txt: Permission denied - Cannot delete via FTP - PLS HELP

Quote Reply
550 file.txt: Permission denied - Cannot delete via FTP - PLS HELP
Hello !

I have a simple script below - This script will make a folder and create 1 file.txt inside - The problem is: how come I cannot use CuteFTP to delete this file.txt (get 550 file.txt: Permission denied)

Here is my script :

#!/usr/bin/perl

# main folder was chmoded 777 by using CuteFTP
$dir = "/home/hwa/public_html/main" ;


# Make new dir "abc" and chmod 777 abc
mkdir ("$dir/abc", 0777);


open (FILE, ">$dir/abc/file\.txt");
print FILE "Something here\n";
close (FILE);


chdir "$dir/abc";
chmod 0777, 'file.txt';


print "Content-type: text/html\n\n";
print "DONE\n";


File file.txt was created OK - But now when I use CuteFTP and want to delete this file - I cannot do it - Please tell me why and how can I delete this file.

Oh, I have tried to remove the code below out of the script but it won't help.

chdir "$dir/abc";
chmod 0777, 'file.txt';


Something strange here : I've tested this script on 2 server. One server I can delete file.txt but the other won't allow me to do it.

Hope you understand what I mean and help me out !

Thanks a lot !

N.A


Quote Reply
Re: [newage24] 550 file.txt: Permission denied - Cannot delete via FTP - PLS HELP In reply to
If the file was created via a CGI script, it's owner is apache (or nobody, or www, or whoever the httpd server runs as) and thus you don't have the permission.

You need to delete it via another cgi script.

--mark
Quote Reply
Re: [Mark Badolato] 550 file.txt: Permission denied - Cannot delete via FTP - PLS HELP In reply to
Hi Mark !

Is there any way to make the script can save a file and after that I can use CuteFTP to delete that file ?

Thanks a lot for your quick help !

N.A
Quote Reply
Re: [newage24] 550 file.txt: Permission denied - Cannot delete via FTP - PLS HELP In reply to
You would need to run a CHMOD and CHOWN on the file.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [A.J.] 550 file.txt: Permission denied - Cannot delete via FTP - PLS HELP In reply to
Hi Andy !

This is a first time I hear about chown - Could you do me a favor - I'd like to see the example for this function chown. I mean - I just want to know how to use cgi script to write a file on server and after that I can use CuteFTP to rename or delete it. I don't know how to add chown to my simple script above.

Thanks for your help Andy !

Regards!

N.A