About Linux FAQ

Browse More FAQs:

Advertisements

Display the security context associated with files or directories under SELinux kernel

Posted by Vivek Gite [Last updated: June 13, 2007]

Q. I’m using CentOS Linux server 5 with SELinux enabled kernel. How do I display the security context associated with files or directories under SELinux kernel? Basically I’d like to know which SELinux security context applies to some files or directories.

A.. To get more information about SELinux security context applied to files and directory you need to use patched ls command. CentOS comes with modified (patched) ls command. Following are the SELinux ls command options:

  • --lcontext : Display security context. Enable -l. Lines will probably be too wide for most displays.
  • -Z or --context : Display security context so it fits on most displays. Displays only mode, user, group, security context and file name.
  • --scontext : Display only security context and file name.

Type ls -Z command you will see the SELinux applied security context:
# ls -Z /var
# ls -Z /home
# ls --lcontext /etc

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Other Helpful FAQs:

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.