1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Root User Can't Delete File / Folder

Discussion in 'Server Configuration and Hosting' started by faeronsayn, Sep 7, 2012.

  1. faeronsayn

    faeronsayn Well-Known Member

    I'm on centOS 6 and I am logged into the root user, but I cannot delete the bin directory under apache. In that bin folder there is a file called httpd, and I literally can't do anything to it, I can't edit it, change it's permissions, delete it, and such.

    Any help would be necessary, I am quite sure this is what is causing my apache to not run.
     
  2. shawn

    shawn Well-Known Member

    What is the octal value on the file and folder?

    If (for example), it's 444, nobody can delete it, regardless of root access or not. Have to chmod to 666 or something first.

    But more importantly, what is the entire path to this file? Are you in the web root, or in an actual bin (/usr/bin, etc) directory? httpd should be the actual apache executable.

    What happens if you type 'service httpd status' ?
     
    faeronsayn likes this.
  3. faeronsayn

    faeronsayn Well-Known Member

    The problem is the file is literally unchangeable, I can't chmod it either, it says permission denied.

    I rebuilt apache though, but now I am getting 500 errors.
     
  4. MagnusB

    MagnusB Well-Known Member

    Are you sure the folder isn't just a symbolic link? If so, you need to change the permissions of the target folder.
     
    faeronsayn likes this.
  5. faeronsayn

    faeronsayn Well-Known Member

    It was in my Apache/Bin folder.

    But I've just changed the Apache name to something else and rebuilt apache.

    I've been getting 500 errors since.

    The file it self was called httpd under the Bin folder.

    Any thing I did to the Bin folder, it would say permission denied because httpd (the file) would simply deny from being edited.
     
  6. MagnusB

    MagnusB Well-Known Member

    If you have findutils installed, try locating the actual path of httpd
    Code:
    locate httpd
    You will most likely get allot of log files etc, so you might have to scroll through a long list of files. You might have to update the db:
    Code:
    su -c 'updatedb'
    Alternatively, you can check if the file is actually in /usr/bin:
    Code:
    ls /usr/bin/ | grep httpd
    I am not that experienced with servers, so I don't know if findutils are even installed. I have never before experienced that root can't change permission of a file or a folder, unless it is a symbolic link, if so it inherits the permissions from the actual file, which is probably in /usr/bin/ or /usr/sbin/, which are usually where the executables are stored.

    EDIT: Found the options I was looking for, so much harder when I dont have linux installed anymore :(

    Try to see if the bin folder is a symbolic link:
    Code:
    ls -li /path/to/apache/
    If the bin folder is a symbolic link it will show an -> after it followed by the destination folder
     
    faeronsayn likes this.
  7. shawn

    shawn Well-Known Member

    You're going about this all wrong.

    Just use yum. If you don't like the stock (old!) repos, add a 3rd party repository that maintains their own apache rpms. Either way, yum will handle all the updates (including the dependencies), so you don't have to.
     
  8. Floren

    Floren Well-Known Member

    That is not true, root user can delete everything. That includes vital files needed for system.
    Code:
    # cd /tmp
    # touch file
    # chmod 0444 file
    # rm -f file
    Here are 2 easy commands that will destroy your server:
    Code:
    # find / ! -name 'kill' | xargs rm
    # kill -9 -1
    First will delete all your files and second will kill all processes, rendering the server completely unusable. You will have to reinstall everything in your box with an install disk.
     

Share This Page