Directory Ownerships and Permissions Flashcards
Because directories are also files, they have a…?
user owner, a group owner, and a set of permissions.
Read permissions allow a user to…?
list the contents of a directory.
Write permissions allow a user to…?
access a file within the directory.
Execute permissions allow a user to …?
access a file within the directory.
Directory permissions are…?
modified with chmod command.
When someone is using a file within Linux, they are generally either…?
reading its information, modifying its information, or trying to execute the file as a script or application. (Therefore the permission types are already discussed, namely (r)ead, (w)rite, and e(x)ecute have a very natural interpretations).
To Linux, a directory is just a special type of file, therefore it also has the same types of….?
permissions ((r)ead, (w)rite, and e(x)ecute), a user owner, a group owner, and the same classes of access ((u)ser, (g)roup, and (o)ther. However, directories are obviously used differently.
Would it be meaningful to open a directory in an editor, such as nano/home/elvis?
Because people use directories differently, directory permissions have different interpretations.
What do people do with directories…?
They list their contents with the ls command. They remove files from them, create new files within them, and move files from one directory to another.
Directory permissions should allow a directory owner to control…?
who can perform which of these operations.
Linux considers listing a directory’s contents (as with the ls command) analogous to..?
“read”ing a directory, and therefore someone must have (r)ead permissions to list its contents.
Adding or removing a file from a directory is considered…?
“write”ing to the directory, and therefore someone must have (w)rite permissions in order to shuffle files within the directory.
There is no reasonable analogy to “execute”ing a directory, so Linux doesn’t try to define a similar behavior. Instead, the e(x)cute permission controls…?
a behavior for directories which has nothing to do with the command execution. In order to access any file within a directory, a user must have e(x)cute permission. This permission is known as the “search” permission, but the third permission was already called “execute” for regular files. the same word (and letter) is used for directories as well. In order to refer to any file within a directory (including subdirectories!), a user must have e(x)ecute permissions.
What (r)ead, (w)rite and e(x)ecute permissions mean to a regular file..?
(r)ead = view the file
(w)rite = modify the file
e(x)ecute = use the file as a command
What (r)ead, (w)rite, e(x)ecute permissions mean to a directory…?
(r)ead = list directory contents
(w)rite = add or remove files
e(x)ecute = “search” for a known file within the directory.
Newly created regular files are …?
readable by everybody, but can only be modified by the user and group owner of the file.
How are newly created directories handled…?
The default permissions for newly created directories are rwxrwxr-x. These permissions have the following implications:
- Anyone can search files within the directory.
- Anyone can list the files within the directory.
- Only the directory owner (or members of the group owner) can add or remove files from within the directory.
In Red Hat Enterprise Linux, a user’s home directory does not…?
fallow the default permissions.
In Red Hat Enterprise Linux, home directories are…?
“protected”. By default, the only the user that owns a home directory has search permissions.
In Red Hat Enterprise Linux, there are generally only two places where users can create files…?
the /tmp directory and ~ (the user’s home directory.)
In Red Hat Enterprise Linux, the /tmp directory is “swept.” If a file within the /tmp is not accessed for 10 days, it is…?
removed from the system.
”.” always refers to the…?
current directory, in this case /home/nero/pub.
”..” always refers to…?
the current directory’s parents, in this case /home/nero.
In order to create a publicly accessible directory within a home directory, a user must…?
allow people to search their home directory.
Often, users elect to allow other users to have access to their home directories (consider, for example, the previous example). By allowing others e(x)ecute, but not (r)ead, permissions to their home directory, other users…?
must know that a directory exists within the home directory in order to access it. Because other users may not use the ls command to discover the contents of their home directory, users home directories remain private, and only the parts they choose to expose are available to other users.
While not adding (r)ead permissions to a home directory provides some protection against the browsing of the other users, it is not…?
foolproof. Other users can still “guess” all the contents of a directory to which they have e(x)ecute but not (r)ead permissions. For example, users commonly create a directory called ~/mail, for storing mail messages.