Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to delete a file on the server but the PHP is still busy on it and wont let me delete it... FTP says SORRY cant do:

> DELE ml.txt
< 550 ml.txt: Permission denied
> PORT 190,028,4,31,129,100

and

> SITE CHMOD 777 ml.txt
< 550 ml.txt: Operation not permitted

What to do, in order to kill the process or delete the file?

share|improve this question

migrated from stackoverflow.com Apr 1 '11 at 22:02

This question came from our site for professional and enthusiast programmers.

3 Answers 3

try, ssh => login as root, try renaming the file and then delete it.

share|improve this answer
    
or else you could also try deleting the files by chmod +777 –  Anonymous Mar 30 '11 at 23:59

Why not just stop the web server and restart?

If running php directly, simply use top to find the process and kill it.

top | grep "php"

Find the process id and then

kill "processId"

or even simpler enough:

killall php
share|improve this answer
  1. login as normal user on ssh
  2. then type in su -
  3. it will prompt you for the root password, then enter that.
  4. one you are in you need to change the owner ship of the file by chown -r change_with_your_username:change_with_your_usergroup change_with_full_path_to_the_file
  5. then try deleting it through ftp or ssh and it should work.

if the steps above dont work then try this

  1. if it is locked as in RCS (revision control system) or SCCS (source code control system) , you (hopefully owner) can unlock it rcs -u YourFileName see man rcs if it is installed in your system. see man sccs to learn how to unlock with sccs. unfortunately i don't know.
  2. if your file is in use, you can see it with fuser -m TheFileName or the directoryName holding it fuser is file user. see man fuser to see how to kill the process using your file. i think it is fuser -km FileName. better investigate it yourself. If you know which process is using your file you can terminate the process with kill command.
  3. use lsattr YourFileName to see the attributes of your file. it might be set as immutable or undeletable with command chattr -i filename or chattr -u filename if so you can do the opposite with chattr +i +u filename see man chattr or man lsattr for more detail. chattr and lsattr come with newer systems. my fedora2 has it. older systems don't
share|improve this answer
    
did it work??? let me know.. :) good luck –  Anonymous Mar 31 '11 at 0:21
    
Thanks user!! +1 again this helps. (I donno why my question got downvoted? I dont care. Your answer rocks.) –  Sam Mar 31 '11 at 0:22
    
thanks sam for the rep. I have upvoted your question because it is perfectly valid and a good question. –  Anonymous Mar 31 '11 at 3:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.