Mastering_Linux_Security_and_Hardening_Third Edition by Donald A. Tevault

Mastering_Linux_Security_and_Hardening_Third Edition by Donald A. Tevault

Author:Donald A. Tevault
Language: eng
Format: epub
Tags: COM046070 - COMPUTERS / Operating Systems / Linux, COM043050 - COMPUTERS / Security / Networking, COM043040 - COMPUTERS / Networking / Network Protocols
Publisher: Packt
Published: 2023-02-22T05:50:47+00:00


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 ~]$ ls -l perm_demo.txt -rw-rw-r--. 1 donnie donnie 0 Nov 5 20:02 perm_demo.txt [donnie@localhost ~]$ sudo chown maggie:maggie perm_demo.txt [donnie@localhost ~]$ ls -l perm_demo.txt -rw-rw-r--. 1 maggie maggie 0 Nov 5 20:02 perm_demo.txt [donnie@localhost ~]$



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.