System: /kernel: Operation not permitted

(last edit: 2001-06-13)


You think you are superuser and you think you are god but you get something like the following: $root@host:/#ls -l ... -r-xr-xr-x 1 root wheel 1782122 Jun 1 20:29 kernel ... $root@host:/#chmod 777 kernel chmod: kernel: Operation not permitted $root@host:/# Lets first take a closer look: $root@host:/#ls -lo ... lrwxr-xr-x 1 root wheel - 9 Apr 10 16:46 home -> /usr/home -r-xr-xr-x 1 root wheel schg 1782122 Jun 1 20:29 kernel -r-xr-xr-x 1 root wheel - 3258128 Jun 13 20:25 kernel.GENERIC ... From the 'ls' man page: "-o Include the file flags in a long (-l) output." So the 'schg' flag is set on that file. You can change this option with the 'chflags' command. man chflags NAME chflags - change file flags SYNOPSIS chflags [-R [-H | -L | -P]] flags file ... DESCRIPTION The chflags utility modifies the file flags of the listed files as speci- fied by the flags operand. ... The flags are specified as an octal number or a comma separated list of keywords. The following keywords are currently defined: arch set the archived flag (super-user only) opaque set the opaque flag (owner or super-user only) nodump set the nodump flag (owner or super-user only) sappnd set the system append-only flag (super-user only) schg set the system immutable flag (super-user only) sunlnk set the system undeletable flag (super-user only) uappnd set the user append-only flag (owner or super-user only) uchg set the user immutable flag (owner or super-user only) uunlnk set the user undeletable flag (owner or super-user only) archived, sappend, schange, simmutable, uappend, uchange, uimmutable, sunlink, uunlink aliases for the above Putting the letters ``no'' before an option causes the flag to be turned off. So when you do the following: $root@host:/#chflags noschg kernel $root@host:/#ls -lo kernel -r-xr-xr-x 1 root wheel - 1782122 Jun 1 20:29 kernel then you see that you are realy the true and only master of your machine.

Click here to go back to the index.