[CentOS] Relabel /usr directory

Tue Feb 4 18:13:08 UTC 2020
Sergio Belkin <sebelk at gmail.com>

nevermind, I think is fixed:

ls -Z  /usr
unconfined_u:object_r:bin_t:s0 bin      unconfined_u:object_r:usr_t:s0 local
unconfined_u:object_r:usr_t:s0 games    unconfined_u:object_r:bin_t:s0 sbin
unconfined_u:object_r:usr_t:s0 include  unconfined_u:object_r:usr_t:s0 share
unconfined_u:object_r:lib_t:s0 lib      unconfined_u:object_r:usr_t:s0 src
unconfined_u:object_r:lib_t:s0 lib64    unconfined_u:object_r:usr_t:s0 tmp
unconfined_u:object_r:bin_t:s0 libexec

isn't it?

I simply re-enabled selinux in /etc/selinux/config and rebooted...

HTH

El mar., 4 feb. 2020 a las 14:59, Sergio Belkin (<sebelk at gmail.com>)
escribió:

> Hi,
> I've done the following:
> - Copy usr content with rsync to another partition:
>
> rsync -av --partial --progress /usr/ /mnt
>
> Then, unmounted, added to fstab a line for /usr, then deleted /usr/* (not
> the directory itself). But I've found that is bad labeled:
>
> ls -Z /usr
> unconfined_u:object_r:unlabeled_t:s0 bin
>  unconfined_u:object_r:unlabeled_t:s0 local
> unconfined_u:object_r:unlabeled_t:s0 games
>  unconfined_u:object_r:unlabeled_t:s0 sbin
> unconfined_u:object_r:unlabeled_t:s0 include
>  unconfined_u:object_r:unlabeled_t:s0 share
> unconfined_u:object_r:unlabeled_t:s0 lib
>  unconfined_u:object_r:unlabeled_t:s0 src
> unconfined_u:object_r:unlabeled_t:s0 lib64
>  unconfined_u:object_r:unlabeled_t:s0 tmp
>
> How can I restore the default contexts?
>
> I've tried with restorecon and with fixfiles, but no luck, for example:
>
> matchpathcon -V /usr
> /usr error: No data available
>
> How can I fix this?
>
> Thanks in advance.
> --
> --
> Sergio Belkin
> LPIC-2 Certified - http://www.lpi.org
>


-- 
--
Sergio Belkin
LPIC-2 Certified - http://www.lpi.org