LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-26-2006, 08:56 AM   #1
suse_buse
LQ Newbie
 
Registered: Oct 2006
Location: Bindura, Zimbabwe
Posts: 2

Rep: Reputation: 0
Root denied permission to remove files


I believe I have a stubborn virus on my system. As root, I find I cannot remove some old files from the system. I get permmision denied error message. Actually its file locked up in .mozilla folder, which will cause the system to crush if the user runs Internet. I can't the delete the problem file either. Here is what I get:

maths:/b/btatira # ls -l /b/btatira/.mozilla/direct/988aw6ks.slt/Cache.Trash/Trash/Cache/_CACHE_001_
/bin/ls: /b/btatira/.mozilla/direct/988aw6ks.slt/Cache.Trash/Trash/Cache/_CACHE_001_: Permission denied

maths:/b/btatira # rm -f /b/btatira/.mozilla/direct/988aw6ks.slt/Cache.Trash/Trash/Cache/_CACHE_001_
rm: cannot remove `/b/btatira/.mozilla/direct/988aw6ks.slt/Cache.Trash/Trash/Cache/_CACHE_001_': Permission denied

'maths' is the host name and 'btatira' was my user account that I deleted except for the file above. '/b' is the second hard-drive where user btatira is located.

My question is how could that be, when I know root can do everything. This us a virus of some sort, shouldn't I think so.
 
Old 10-26-2006, 09:16 AM   #2
craigevil
Senior Member
 
Registered: Apr 2005
Location: OZ
Distribution: Debian Sid/RPIOS
Posts: 4,884
Blog Entries: 28

Rep: Reputation: 533Reputation: 533Reputation: 533Reputation: 533Reputation: 533Reputation: 533
Try opening your trash folder and looking in the info directtory. I had this happen once. The file had created an info file that wasn't getting deleted.
 
Old 10-26-2006, 05:17 PM   #3
HGeneAnthony
Member
 
Registered: Mar 2003
Posts: 178

Rep: Reputation: 30
Reply

Linux systems will let you delete files if they are in memory or not (unlike Windows). There's a few ways to prevent root from deleting a file. One of which is with the immutable or read only flags. Check the files with:
lsattr filename

This will tell you what files are tagged and with what options. You can remove/add options with -/+. For example, chattr -i filename will remove the immutable flag. The other issue can be using another permission system like SELinux (which comes by default with Red Hat Enterprise Linux). I doubt these are the issues though. Here's what you could try. First backup the .mozilla directory in your home directory.

cp -Rf ~/.mozilla ~/.mozilla_backup

Then delete the mozilla directory.

rm -Rf ~/.mozilla

Then start firefox. It will create a new .mozilla directory. You can reimport the bookmarks by going into .mozilla_backup/firefox and looking for a profile (these use random names). Search through it and find bookmarks.html and overwrite the new profile. This is just a guess though try it out. If you have problems you can always just move back the old folder.
 
Old 10-26-2006, 06:56 PM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
The only cases I know where rm will fail are:
  • Trying to delete a file from a filesystem which is mounted readonly. This may be because the filesystem type does not support writing (e.g. iso9660), because the fileysystem has been explicitly mounted readonly, or the OS was automatically remounted the filesystem readonly because errors were detected.
  • Corrupted directory entries
  • Permissions (check the owner and permissions of the parent directory)

Eliminate these before virus checking, although a virus check won't hurt, but you'll probably be wasting your time.

To check the filesystem, do this command:

Code:
mount |fgrep $(df -k /home/matthew/.mozilla/ |tail -n 1 |awk '{print $1}')
The last column will show mount flag. If you see "ro" as one of the items in the comma separated list in brackets , it's mounted read-only ("ro" on it's own, not "remount-ro").

You should also see the error message when you try to delete the file as "read-only filesystem".

For corrupted filesystem entries, you tend to see junk in the file attributes. So if you do ls -l [parent-directory], you'll see some files with really messed up file-permissions and size, and owner etc.

Finally, make sure the parent directory of the file you want to delete is writable, readable and executable by the user who you want to do the delete as. Of course, root can do pretty much anything to any directory regardless of permissions, so I expect it's a corrupt filesystem.

follow the usual fsck procedures. Anyone have a good link for handling corrupt filesystems on Linux?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Root denied permission to remove users' files suse_buse Linux - Security 2 10-25-2006 08:26 AM
permission denied for root in FC4: why can't I modify own files? ixis Linux - General 4 12-10-2005 06:05 PM
denied permission as root kupek85 Linux - Software 3 08-24-2004 06:51 PM
Permission denied as root Cynric Linux - General 4 08-15-2004 11:47 AM
su root permission denied exodist Linux - Software 4 07-23-2004 03:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration