LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   A slight problem with file permissions (https://www.linuxquestions.org/questions/slackware-14/a-slight-problem-with-file-permissions-346895/)

f0rk 07-26-2005 07:59 AM

A slight problem with file permissions
 
Following the advice found on this page: http://members.cox.net/laitcg/new/ss.html offered, I executed a shell script that changes the permissions of certain important files to keep others who may at one time or another break into my PC from writing to them.

It worked good too, because now I can't write to the ones that were chmod 600 even as root. Which is a problem becuase I need to tweak one of them a little bit.

I ought to have tested a non-mission critical file before I did this, but I thought that if the file was rw I'd still be able to edit it as root, but I can't. The file can't be deleted, chmod'd, written to or anything. I'll never do that again.

Is there a way in which to change the file permissions on it so that I can modify it?

piete 07-26-2005 08:38 AM

Ah! Erk, that's painful ...

Are you sure that the file owner is root?

Try experimenting with a liveCD - file ownership is based on user ID, so you could tweak it there.

Also, looking at that script: is the chmod'd files that you're having problems with, or the chattr ones? chattr -i might be the way forward ...

Good luck!
- Piete.

f0rk 07-26-2005 08:45 AM

It's the chattr'd ones actuallly ... yeah my lilo.conf and inetd.conf certaily are immutable! I can change it if I boot off a Slack10 CD and try to fix it that way?

f0rk 07-26-2005 08:56 AM

Ah ... I think I figured it out ... this is interesting:

Quote:

A file with the `i' attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file and no data can be written to the file. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
found this at: http://linuxreviews.org/man/chattr/

Now, as root I do have the CAP_LINUX_IMMUTABLE capability so, I can change the files back as needed, tweak them and write to them as necessary and then chattr them back again. All I need to do now is read that man page and get the command switches right.

If that plan doesn't work I'll boot off my live Slack CD and try again that way.

keefaz 07-26-2005 08:57 AM

You don't need to boot from a CD to execute chattr -i a file
(exept if you can't boot from hd due to a misconfigured chattred lilo.conf :))


All times are GMT -5. The time now is 10:30 AM.