could not delete file in unix

Posted on 2006-03-30
Last Modified: 2010-04-21

  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.
Question by:sumanth_ora
    LVL 48

    Expert Comment

    What error do you get?

    Are you the owner of the file?

    Is the file on a NFS mounted filesystem?
    LVL 38

    Accepted Solution

    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.
    LVL 4

    Expert Comment

    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.
    LVL 43

    Expert Comment

    > 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).

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
    Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap ( Version 1.2 2.      Jpcap( Version 0.6 Prerequisite: 1.      GCC …
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now