Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I accidently copied some system directories (boot, sys, etc) to my home directory (did you like how "etc" both means the etc directory and etcetera there?) and I also changed them all so that they are owned by me rather than root.
I can't seem to delete them no matter what I try. rm doesn't work (with or without sudo mode) and neither does chown.
Here's an example of some files I can't delete:
[wonna@wearcontinue-dl boot]$ ls -l
-rwxrwxrwx 1 wonna users 115179 Aug 29 09:17 config-3.3.4-5.fc17.x86_64
drwxrwsrwx 2 wonna users 4096 Aug 29 15:07 extlinux
drwxrwsrwx 2 wonna users 4096 Aug 29 15:07 grub
drwxrwsrwx 2 wonna users 4096 Aug 29 15:07 grub2
-rwxrwxrwx 1 wonna users 17921070 Aug 29 09:17 initramfs-3.3.4-5.fc17.x86_64.img
drwxrwsrwx 2 wonna users 4096 Aug 29 09:17 lost+found
-rwxrwxrwx 1 wonna users 2412391 Aug 29 09:17 System.map-3.3.4-5.fc17.x86_64
-rwxrwxrwx 1 wonna users 4662160 Aug 29 09:17 vmlinuz-3.3.4-5.fc17.x86_64
And it doesn't make a difference whether I do it in sudo mode or not. Interestingly enough, chmod works fine on all the files, yet chown and rm don't. I would think that if I can set all of their modes to 777, then I should be able to delete them.
Originally my home data was under a non-NFS dir (home/wonna). I wanted to move everything into homes/wonna and make that my new home directory. I tried to use "sudo usermod -d /homes/wonna wonna" but it gave me an error message stating that "wonna" was logged in, so you couldn't change it. I didn't have another account to use, so I modified /etc/passwd and changed my home directory from /home/wonna to /homes/wonna. Then I copied all of my stuff over. A lot of problems came up with copying the stuff over and unfortunately I don't remember what all of them were or how I fixed them.
In the process of copying everything over I did a lot of chmod and chown stuff, and I copied all of those important directories (boot, sys, etc) into /homes/wonna. Things were pretty messy and I didn't know what should have what permissions and I had trouble deleteing some things, so at last I decided to re-image my machine. In my mind, re-imaging would mean a fresh start on a clean slate, but I forgot that the NFS stuff would not actually be wiped.
So I formatted my computer, reinstalled Fedora, edited the /etc/passwd file again to make my home under the homes directory and that's where I had the problems deleting files.
So perhaps since I re-installed linux it doesn't think that the "wonna" that owned the files was the same as the "wonna" who I am currently now? I don't know. I didn't set up a new account or anything, all of the accounts are managed on my companies network, but perhaps this could still be a clue to what is going on.
In answer to my question about it thinking that there are somehow two "wonna"s. I don't think that is it. Because I can do chwon wonna:users to a file and it works just fine. But then I still can't delete it.
Its kind of funny because with all of that hard work dealing with chmod and chown, it didn't occur to me to just try the GUI. For some strange reason, editing the permisions in the GUI (right click, properties, permissions, and then just give everyone permissions to write and delete) worked just fine. I really don't know why that would make a difference, but it did. So I deleted all of those annoying files and directories. Its funny, because an average guy who knows nothing about linux commands probably could have fixed it much faster than a team of geeks.
There's still a more important problem though: I still can't get sudo to work in my new home directory.
I've tried a few commands to see which ones work and which ones say "Permission denied" from /homes/wonna/
Commands that work:
sudo vi foo //but if the permisions are rw-r--r--, it will open it in read only mode
Never mind. It turns out that for security reasons, no one at my company can use sudo in their NFS mounted home folders.
The problem is solved
As far as why it worked in the GUI but didn't work in the terminal, my guess is that the files had ext[2/3] attributes. The UI must use chattr, which I did not know how to use until I investigated further.
Then again, I know that there's some funky stuff about NFS with ext[2/3] attributes, so I'm not sure if chattr is even possible with it, but either way, my system works again, so I'm going to move on.
Permissions was clear - owner of "boot" dierectory (or anybody, but root) have no rights to modify "boot" contents, like deleting files. Only root could delete these files, but as mentioned ealier, local root is changed to other (non privileged) accout on NFS share. Just changing permissions of "boot" (as owner you can do this) and you would be able to delete files.