Root User Can't Delete File / Folder

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.
 
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' ?
 
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' ?

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.
 
Are you sure the folder isn't just a symbolic link? If so, you need to change the permissions of the target folder.

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.
 
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
 
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.
 
If (for example), it's 444, nobody can delete it, regardless of root access or not.
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.
 
Back
Top Bottom