Solved

selinux chcon

Posted on 2014-09-15
4
212 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 37

Expert Comment

by:Gerwin Jansen
Comment Utility
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
Comment Utility
#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
Comment Utility
great job and sorry for me not getting back
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now