# -r-sr-xr-x  file removal



## jaymax (Oct 7, 2015)

```
FreeBSD MACH1 10.2-RELEASE FreeBSD 10.2-RELEASE #0 r286666: Wed Aug 12 19:31:38 UTC 2015  root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  i386
```

I am attempting to clean up an archival collection of file, some have permissions with suid/guid set: Ex: -
-r-sr-xr-x
even some lib*.so.n files with an apparent straight forward '-r--r--r--' permission settings.

```
-r--r--r--  1 root  wheel  schg 1389564 Jan 16  2014 libc.so.7
```

All attempts at removal `chmod` | `chflags` failed, receiving an "Operation not permitted" message returned.

I thought I had done this some time ago with `chflags` but memory must have failed, could someone direct me in the right direction - surprisingly I could not find any reference in the Handbook or Forum, probably I have been searching with incorrect keywords.

Thanks!


----------



## SirDice (Oct 7, 2015)

The schg flag has been set so you need (as root) `chflags noschg libc.so.7`. After that you should be able to remove the file.


----------



## danger@ (Oct 14, 2015)

unless a kern.securelevel has been set higher than 0, in such case you won't be able to remove those flags, see security(7).


----------

