• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • Last Modified:

could not delete file in unix


  I have a file(Below mentioned) in unix.Could not delete it with rm command.Bascially i down loaded this file for gzipl(gzip exe).Please help me on this.

-rw-r--r--   1 jg88723  aml       507392 Mar  8 16:48 gzipl

please help me on this.
1 Solution
What error do you get?

Are you the owner of the file?

Is the file on a NFS mounted filesystem?
if you login name is not jg88723 and you current session is not the super user root, you don't have permission to delete the file.

You can su as root (if you know the password) to delete or ask your sys adm to do it for you.
As pointed by yuzh, you can not delete a file if you are neither the administrator (root) nor the owner of the file. If you are indeed the owner of the file (jg88723  in this case), it is still possible not to be able to delete the file. This happens when the write permission from the parent directory of the file is removed after the file is created.

Solution: Go to the directory that contains the parent directory of this file. For example if the above ls command was used from directory /user/home/temp/data1, then go to directory /user/home/temp/ . If you do an ls here, you will see that the write privilege on the directory has been removed. Change the privilege by executing the following:

$ chmod u+w data1

Now the directory will be writable. It would now be possible to go to the directory where file gzipl is executing and remove the file.

The whole solution is only applicable of you are owner of the file and the directory.
> As pointed by yuzh, you can not delete a file if you are neither the administrator (root) nor the owner of the file.
Correction. You don't have to own the file. You have to have write permission to the directory it resides in (unless there is sticky bit set on the dir).
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now