Re: How do you relabel all SELinux file contexts of an offline system's file system?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 04, 2015 at 03:33:05PM -0700, Bond Masuda wrote:
> Hello,
> 
> Normally, if I need to ensure that all the SELinux file contexts are
> correct, I run:
> 
> restorecon -R -v /
> 
> However, in the current situation, I need to do that on a system that is
> offline, where I have it's root and entire file system mounted under
> /mnt. I tried:
> 
> chroot /mnt /usr/sbin/restorecon -R -v /mnt
> 
> hoping it would have the same effect, but it does not appear to. When I
> boot the offline system, it shows a lot of SELinux mislabelings.
> 
> Is there a way to fix SELinux file contexts of another system while it
> is offline?
> 
> Thanks for any help...
> -Bond

Look at setfiles, you want something like this:

setfiles -vr /mnt/ /etc/selinux/strict/contexts/files/file_contexts /mnt/

from setfiles(8):
       -r rootpath
              use an alternate root path.

-- Jason
_______________________________________________
Selinux mailing list
Selinux@xxxxxxxxxxxxx
To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx.
To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux