Re: Allowing noschg in multi-user mode on Mac OS X

"Kelly Jones" <[email protected]>
Newsgroups gmane.org.user-groups.nmlug
Message-ID <[email protected]>
On 7/9/07, Larry W. Wood <[email protected]> wrote:
> On Jul 9, 07, at 10:40 AM, Michael Maddex wrote:
> > Have you tried using the "sudo" command?  For example:
> > $ sudo chflags noschg test.txt
>
> Unfortunately, that won't work!  Kelly is exactly right in everything
> he described.
> As root, you can set the system immutable flag, but you cannot unset it.
> Also, unfortunately, once you set the flag on a file, you cannot make
> any changes to the file, including deleting it.
> This is true, at least, in my version of bash:
>
> 		GNU bash, version 2.05b.0(1)-release (powerpc-apple-darwin8.0)
> 		Copyright (C) 2002 Free Software Foundation, Inc.
>
> I tested this by creating my own test.txt and setting the "schg" flag.
> Now I have a 0-byte file that I can't get rid of easily.
> I trust that Kelly is also correct that by booting into single-user
> mode, I will be able to unset the flag or delete the file.
> That's too much trouble to go to to remove a small file that is
> causing no problems, so far.
> If it starts to affect my backup procedure, however, I'll quickly
> change my mind.
>
> Why this condition exists, I have no idea.  But I don't like it
> either!           --  Woody

Thanks to everyone who helped. I'd done "sudo su", so, yes, I was
"root-ified". For reference, I got this answer from another group:

"man sysctl" on Mac OS X gives:

Name                            Type          Changeable
[...]
kern.securelevel                integer       raise only

And running the command to display this kernel variable:

# sysctl kern.securelevel
kern.securelevel = 1

"man 3 sysctl" and looking at KERN_SECURELVL is similar.

kern.securelevel is apparently what controls whether you can noschg in
multi-user mode or not.

-- 
We're just a Bunch Of Regular Guys, a collective group that's trying
to understand and assimilate technology. We feel that resistance to
new ideas and technology is unwise and ultimately futile.
_______________________________________________
NMLUG mailing list
[email protected]
http://lists.b9.com/cgi-bin/mailman/listinfo/nmlug
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.