Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Linux Security and Hardening

You're reading from   Mastering Linux Security and Hardening Protect your Linux systems from intruders, malware attacks, and other cyber threats

Arrow left icon
Product type Paperback
Published in Feb 2020
Publisher
ISBN-13 9781838981778
Length 666 pages
Edition 2nd Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Donald A. Tevault Donald A. Tevault
Author Profile Icon Donald A. Tevault
Donald A. Tevault
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Preface 1. Section 1: Setting up a Secure Linux System
2. Running Linux in a Virtual Environment FREE CHAPTER 3. Securing User Accounts 4. Securing Your Server with a Firewall - Part 1 5. Securing Your Server with a Firewall - Part 2 6. Encryption Technologies 7. SSH Hardening 8. Section 2: Mastering File and Directory Access Control (DAC)
9. Mastering Discretionary Access Control 10. Access Control Lists and Shared Directory Management 11. Section 3: Advanced System Hardening Techniques
12. Implementing Mandatory Access Control with SELinux and AppArmor 13. Kernel Hardening and Process Isolation 14. Scanning, Auditing, and Hardening 15. Logging and Log Security 16. Vulnerability Scanning and Intrusion Detection 17. Security Tips and Tricks for the Busy Bee 18. Assessments 19. Other Books You May Enjoy

Using chown to change ownership of files and directories

Controlling access to files and directories really just boils down to ensuring that the proper users can access their own files and directories and that each file and directory has permissions set in such a way that only authorized users can access them. The chown utility covers the first part of this equation.

One unique thing about chown is that you must have sudo privileges to use it, even if you're working with your own files in your own directory. You can use it to change the user of a file or directory, the group that's associated with a file or directory, or both at the same time.

First, let's say that you own the perm_demo.txt file and that you want to change both the user and group association to that of another user. In this case, I'll change the file ownership from me to maggie:

[donnie@localhost...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £16.99/month. Cancel anytime