Solved

selinux chcon

Posted on 2014-09-15
4
223 Views
Last Modified: 2014-09-26
I am looking for a man page, --help or an info page on a redhat 5 system that gives me a clear example of how to use the chcon command.  I forget the syntax and at work I am on a network that does not permit us checking on the web.  

redhat 5+
0
Comment
Question by:TIMFOX123
4 Comments
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40323627
http://www.linuxcommand.org/man_pages/chcon1.html

CHCON(1)                         User Commands                        CHCON(1)




NAME

       chcon - change security context


SYNOPSIS

       chcon [OPTION]... CONTEXT FILE...
       chcon [OPTION]... --reference=RFILE FILE...


DESCRIPTION

       Change the security context of each FILE to CONTEXT.

       -c, --changes
              like verbose but report only when a change is made

       -h, --no-dereference
              affect  symbolic links instead of any referenced file (available
              only on systems with lchown system call)

       -f, --silent, --quiet
              suppress most error messages

       -l, --range
              set range RANGE in the target security context

       --reference=RFILE
              use RFILE’s context instead of using a CONTEXT value

       -R, --recursive
              change files and directories recursively

       -r, --role
              set role ROLE in the target security context

       -t, --type
              set type TYPE in the target security context

       -u, --user
              set user USER in the target security context

       -v, --verbose
              output a diagnostic for every file processed

       --help display this help and exit

       --version
              output version information and exit

Open in new window

0
 
LVL 13

Accepted Solution

by:
Sandy earned 500 total points
ID: 40324564
#chcon is used to change the context of any file..

# ls -lZ /var/log/messages

#ls -lZ /var/www/html/index.html

above both files have there different contexts.. but to provide reference and change them we use #chcon

#chcon --reference /var/log/messages /var/www/html/index.html

#ls -lZ /var/www/html/index.html

Now index.html also has the same context as /var/log/messages has because we changed it using above command to restore we use .. #restorecon -R /var/www/html/index.html

TY/SA
0
 

Author Closing Comment

by:TIMFOX123
ID: 40346081
great job and sorry for me not getting back
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to mount nfs share on this CentOS server? 6 52
Upgrade BIOS / EUFI at Scale 4 69
Apache LDAP Authentication 20 51
Enable SPF on IMSVA 6 13
If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question