Filesystems and Storage File Attributes
Filesystems and Storage File Attributes
Overview
The Linux operating systems allows for a high degree of control over access to files and
directories. Each file and directory has attributes that determine access at the owner, group,
and world level. These attributes are used to determine whether a user or process can read,
write, and execute a file.
Key Ideas
Permission levels: Each file and directory has permissions set at three levels: owner, group,
and world. The permissions at each level can be represented together as an octal (three
digit number with one number each for owner, group, and world permissions).
Permission types: Permission is given to perform actions on files and directories: read,
write, and execute. To calculate the octal representation of what permissions are allowed
to group, each action is worth a certain number or points. Read permission = 4, Write
= 2, Execute = 1. For example, if permissions allow for read, write, and execute, that is
represented as a 7.
ls -l: The ls command for listing files in a directory has “-l” argument which gives the file
attributes of each file and directory. The first 10 characters of the ls -l command are file
attributes.
2
File Attributes
8th - 10th characters: World permissions (read and execute, but not write = 5)
Owner: root
Group: root
chown: The chown command is for changing the ownership of a file or directory.
Example Scenario
The following series of examples shows different scenarios where you can discover and
change file attributes.
Now Do It
1. Find the file attributes of the /home directory.
3. If a file’s permissions are represented by 755, what actions can members of the
owner group take?
4. Create a file in /root called star.txt, and change its ownership a different user.
5. Change the permissions of of star.txt so that the owner, owner group, and world
can read and execute.
3
File Attributes
Answer Key
1. Find the file attributes of the home directory
# ls -l /
drwxr-xr-x. 3 root root 21 Feb 8 13:09 home
3. 755 means members of the owner’s group can read and execute
4
Get Certified!
Get more information at http://training.linuxfoundation.org/certification/lfcs