Write the command that will change the SELinux context type of
the file /tmp/monkey, from user_tmp_t to dhcp_etc_t.
Now this kind of depends on wht you're shooting for. If you just want to change the context type on the one file, you can do this:
# chcon -t dhcp_etc_t /tmp/monkey
However, by using chcon, the possibility exists that the context will revert if/when the filesystem is relabeled.
Now, if you have a set of files that you want a specific context and you want new files to automatically get the context, you'd:
Now this kind of depends on wht you're shooting for. If you just want to change the context type on the one file, you can do this:
# chcon -t dhcp_etc_t /tmp/monkey
However, by using chcon, the possibility exists that the context will revert if/when the filesystem is relabeled.
Now, if you have a set of files that you want a specific context and you want new files to automatically get the context, you'd:
Thanks for explaining this so succintly @Tracy_Baker !
Tracy, you know I just wanted to change the context on that one file.
You just wanted to show your SELinux muscle with that extra stuff
Thanks for saving me some keystrokes in having to type the answer.
Your use of the chcon command is what I was looking for.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.