Sticky file

robids
robids used Ask the Experts™
on
Hello,
I have a file that has somehow had it's permissions messed up. It no longer poses any problem but I would like to know if there is anyway to correct it so that it may be deleted.

# -r---wS---    1 569931200 1014971750    16384 Aug 23  2002 TERM.MAP


Thanks
Rob.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2005

Commented:
As root execute 'chmod 0644 TERM.MAP'. You should then be able to delete it.

Author

Commented:
That gives me the following error
chmod: changing permissions of `TERM.MAP': Operation not permitted
I believe that the problem is the non existent user and group.
Top Expert 2005
Commented:
The bogus user/group should have no bearing on root executing chmod on the file, providing that the problem in only a bogus username & group. Given the values for the UID & GID that ls reports and the funny file permissions I'm more inclined to believe that this is the result of a fault in the file system that holds the file. If that were to be the case any form of chmod or chown will fail because the prolem lies in the structure of the file system rather than it simply being messed up permissions. I was supicious of that when I first saw the question, but hoped that if wasn't that serious.

The first thing that I'd try at this point is to take the system down and fsck the file systems. It might be that the damage is repairable. I don't know what Linux this is, but a RedHat system or similar would want you to execute a 'touch /forcefsck' and reboot. It isn't safe to fsck a mounted file system and that will casue the OS to fsck the file systems without them being mounted.
Should you be charging more for IT Services?

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Commented:
The ability to remove a file depends on the permissions of the directory containing the file, not on the file itself. Do you have the correct permissions on that directory?

Author

Commented:
You are correct to believe that it is a file system problem since root is unable to unlike this file. This file has caused great trouble when it happend and is now isolated in the /tmp directory.  I thought that doing a fsck on a reboot would repair it but I dont have much experiance in doing such a operation. Should e2fsck be used insted?
This is redhat 7.2
Top Expert 2005

Commented:
Don't try to manually run e2fsck on the file system unless you do the operation while booted from alternate media. Running fsck on a mounted file system can damage a file system beyond repair. The RedHat bootup procedure will automatically run an fsck if you execute 'touch /forcefsck' and reboot. And it will do that in a manner that is safe.

Author

Commented:
I tried the touch /forcefsck and rebooted with very little success. It booted with red [FAILED] while trying to mount and would not proceed past.  I had to restore the system from tape since i could not recover from what ever happend there.
All is fine again  execpt for the messed up file is still there. I then tried to run fsck and e2fsck from a boot floppy with no success meaning nothing was repaired or found wrong. This system has only one file system two if you count /boot.
Thanks
Rob
Top Expert 2005

Commented:
On the reboot did the system get to the point of executing e2fsck on each file system? If it did and that failed I'd suspect that you may have a disk drive problem. A reload from tape might still work if the disk errors are in a region of the disk that the re-load didn't write to (say a high order block number). The reload will pack data onto the disk stating from the beginning of each partition which may not reach a bad area of the drive.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial