| Author |
Message |
thunor

Joined: 14 Oct 2010 Posts: 342 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Mon 14 Mar 2011, 18:20 Post subject:
Write permissions ignored [SOLVED] |
|
Hi
I've used Linux for some time but I've only recently been playing with Puppy Linux. In fact with this latest 5.20 release I'm using it more than my regular installed distro; it's a great piece of work, well done.
I just attempted to stop a game from writing to its rcfile and so I set the permissions to r--r--r-- i.e. 444, but the game still kept modifying it and I did too by opening it in Geany, modifying it and saving it back out. I know that everything's root:root, but is this behaviour correct?
Cheers,
Thunor
Last edited by thunor on Mon 21 Mar 2011, 17:29; edited 1 time in total
|
|
Back to top
|
|
 |
thunor

Joined: 14 Oct 2010 Posts: 342 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Tue 15 Mar 2011, 08:57 Post subject:
|
|
Well, I guessed either I've asked a question that's been asked a million times before or I've underestimated the power of the superuser
I've just tested this in a regular Linux installation and indeed when you are root, permissions are ignored. You can set permissions to 000 and it makes no difference with what you can do to it. I didn't know that!
|
|
Back to top
|
|
 |
Shep
Joined: 08 Nov 2008 Posts: 840 Location: GIRT-BY-SEA
|
Posted: Tue 15 Mar 2011, 11:23 Post subject:
|
|
Yes, operating as root poses a hazard in not having the file permissions recognized!
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6179 Location: Auckland, New Zealand
|
Posted: Fri 18 Mar 2011, 20:21 Post subject:
|
|
Maybe you can run the game as another user.
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
PupGeek
Joined: 06 Sep 2009 Posts: 388
|
Posted: Sat 19 Mar 2011, 17:50 Post subject:
|
|
Another idea is to make a backup copy of the *rc file named with a .bak extension and write a script to copy the backup copy to the original *rc file before executing the program in question. It will perform as though it didn't write to the *rc file because you keep going back to the earlier one. If you want to be even more sophisticated you can include an option to save any changes the program made or not in the script to run when you close the program. Shell scripting makes almost anything like that doable.
|
|
Back to top
|
|
 |
Bruce B

Joined: 18 May 2005 Posts: 10817 Location: The Peoples Republic of California
|
Posted: Sat 19 Mar 2011, 20:42 Post subject:
|
|
How to make a file immutable. Root cannot modify it or even delete it.
Except with chattr to put attributes back.
Code block demonstrates
| Code: | [/mnt/sda2/lupu] chattr +i isolinux.cfg
[/mnt/sda2/lupu] lsattr
-------------- ./lupu-520.iso.md5
----i--------- ./isolinux.cfg
-------------- ./lupu-520.iso
-------------- ./boot.msg
-------------- ./help.msg
-------------- ./help2.msg
[/mnt/sda2/lupu] rm isolinux.cfg
rm: remove write-protected regular file `isolinux.cfg'? y
rm: cannot remove `isolinux.cfg': Operation not permitted
[/mnt/sda2/lupu] |
~
_________________ New! Puppy Linux Links Page
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6179 Location: Auckland, New Zealand
|
Posted: Sat 19 Mar 2011, 21:03 Post subject:
|
|
I get this error
| Code: | /# chattr +i NewFile
chattr: Inappropriate ioctl for device while reading flags on NewFile |
Google indicates this normally occurs when the file system is not ext2/ext3... I wonder what it means otherwise.
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
Bruce B

Joined: 18 May 2005 Posts: 10817 Location: The Peoples Republic of California
|
Posted: Sat 19 Mar 2011, 21:16 Post subject:
|
|
| disciple wrote: | I get this error
| Code: | /# chattr +i NewFile
chattr: Inappropriate ioctl for device while reading flags on NewFile |
Google indicates this normally occurs when the file system is not ext2/ext3... I wonder what it means otherwise. |
» don't keep trying expecting to get a different result, you are stuck
» I worked around it one time by rebooting, then immediately running
the command
» Some other workaround suggestions available, if I can find a kid to
advise me
» Maybe helps if not a zero byte file, I've not tested that
~
_________________ New! Puppy Linux Links Page
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6179 Location: Auckland, New Zealand
|
Posted: Sat 19 Mar 2011, 21:27 Post subject:
|
|
| Quote: | » Maybe helps if not a zero byte file, I've not tested that
|
FWIW it's not a zero byte file.
I'm not worried - I was just trying it out.
It works on files on my ext3 partition, just not in my ext2 save file (which is stored on a FAT partition, although I don't think that should matter.
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
Bruce B

Joined: 18 May 2005 Posts: 10817 Location: The Peoples Republic of California
|
Posted: Sat 19 Mar 2011, 22:56 Post subject:
|
|
| disciple wrote: | | Quote: | » Maybe helps if not a zero byte file, I've not tested that
|
FWIW it's not a zero byte file.
I'm not worried - I was just trying it out.
It works on files on my ext3 partition, just not in my ext2 save file (which is stored on a FAT partition, although I don't think that should matter. |
It matters to me. I just tried it on Lupu 5.20 with a ext3 save file stored on an ext3 partition and it didn't work.
chattr is tool used in hardening your Linux, if it doesn't work, I suppose it is not configured to work.
I'll test things by running an actual Linux live CD. But, not a Linux I expect to be crippled or missing standard functions.
I'll report back.
~
_________________ New! Puppy Linux Links Page
Last edited by Bruce B on Sat 19 Mar 2011, 23:46; edited 1 time in total
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6179 Location: Auckland, New Zealand
|
Posted: Sat 19 Mar 2011, 23:15 Post subject:
|
|
FWIW if I mount my backup save file (by clicking on it in Rox) it works on files in that.
So I guess it is related to unionfs or something...
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6179 Location: Auckland, New Zealand
|
Posted: Sat 19 Mar 2011, 23:35 Post subject:
|
|
Ah. Of course. Unionfs is not ext2/3, therefore it does not work. If I go to /initrd/pup_rw then it works.
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
Bruce B

Joined: 18 May 2005 Posts: 10817 Location: The Peoples Republic of California
|
Posted: Sat 19 Mar 2011, 23:44 Post subject:
|
|
| disciple wrote: | | Ah. Of course. Unionfs is not ext2/3, therefore it does not work. If I go to /initrd/pup_rw then it works. |
Interesting. Nuances, good catch and workaround.
Here are my test results
I used a Live CD (smaller than Puppy Lupu)
Filename: Bootable ISO (RIPLinux-11.6-non-X.iso)
RIP LinuX home page
The test was successful.
If thunor is still reading, the complaint is solved. Well, thunor what will it
be?
~
_________________ New! Puppy Linux Links Page
|
|
Back to top
|
|
 |
jpeps
Joined: 31 May 2008 Posts: 2421
|
Posted: Mon 21 Mar 2011, 01:53 Post subject:
|
|
| disciple wrote: | | Ah. Of course. Unionfs is not ext2/3, therefore it does not work. If I go to /initrd/pup_rw then it works. |
yeah..doesn't work on pen drive for the same reason. Interesting command though...new to me. I'm surprised it isn't used more. I can think of lots of ways to employ it (like preventing permissions from getting overwritten and breaking cups, etc)
edit: I tested on some root:nobody cups files, such as /etc/printer.conf, and the printer works. Overwriting "nobody" permissions is the most common cause of cups breaking.
|
|
Back to top
|
|
 |
amigo
Joined: 02 Apr 2007 Posts: 1757
|
Posted: Mon 21 Mar 2011, 02:24 Post subject:
|
|
"I'll test things by running an actual Linux live CD. But, not a Linux I expect to be crippled or missing standard functions."
|
|
Back to top
|
|
 |
|