From the course: Linux CentOS 7: Files and Permissions
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
File ownership - Linux Tutorial
From the course: Linux CentOS 7: Files and Permissions
File ownership
- [Narrator] Before we can talk about setting permissions, we need to talk about file ownership. A file is owned by exactly one user owner and one group owner. If we do an ls-l on a file, we'll see that the long list includes the file's owners. I'm using a fictitious file name, file.txt as an example. You can do a long list on any file in your OS to see similar data. The user owner is the third column from the left. The group owner is the fourth column. The command we use to change the ownership of a file is called chown. The syntax is chown space, options space, username colon group name space file name. To set the user owner, we just use one name. For instance, chown space bob space file.txt would change the user owner to bob. Keep in mind that in order to change the ownership of a file, you need to either be root or elevate privileges with sudo. To set the group owner, the syntax would be chown, space, colon, the group name, in this case, bobgroup, space, file.txt. To set both the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Standard Linux permissions overview1m 47s
-
File and directory modes1m 19s
-
File ownership4m 34s
-
Set permissions using numeric method3m 13s
-
Set permissions using symbolic method5m 16s
-
Default permissions using umask5m 51s
-
Special file bits: SUID and SGID3m 49s
-
Special directory bits: SGID and Sticky6m 26s
-
-
-