MODULE 17- Owners and permissions Flashcards

1
Q

Which user is the owner of a file by default when it’s created?

A

The user who created the file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which group becomes the group owner of a file by default when a user creates it?

A

The user’s primary group

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which command should be used to check which groups you can switch to using newgrp?

A

groups

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What determines the ownership of a file internally in the operating system?

A

→ UID for user ownership and GID for group ownership

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which command is used to verify the current user and their group memberships, including UID and GID?

A

id

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which situation is indicated when a user and their primary group share the same name and numeric ID?

A

→ The user is in a User Private Group (UPG)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which command is used to create an empty file that will automatically be owned by the current user and group?

A

touch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which part of this command output represents the user and group owner: -rw-rw-r–. 1 sysadmin sysadmin 0 Oct 21 10:18?

A

→ The first ‘sysadmin’ is the user owner, the second ‘sysadmin’ is the group owner

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which command reveals all files, including hidden ones, along with their ownership and permissions?

A

→ ls -la

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which command is used by a user to change their current primary group during a session?

A

→ newgrp group_name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What must be true for a user to successfully switch to another group using newgrp?

A

→ The user must already be a member of that group

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which command shows the current primary group and all group memberships with UID/GID details?

A

id

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

After using newgrp research, which group will new files belong to by default?

A

→ The research group

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How can a user return to their original primary group after using newgrp?

A

→ By running the exit command to leave the subshell

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which command is used by administrators to permanently change a user’s primary group?

A

→ usermod -g groupname username

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which command is used to change the group owner of a file?

A

→ chgrp group_name file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is required for a non-root user to successfully change a file’s group using chgrp?

A

→ The user must own the file and the target group must be one they are a member of

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does this command do: chgrp research sample?

A

→ Changes the group ownership of the file sample to the research group

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Which option allows chgrp to change the group of all files and subdirectories in a directory?

A

→ -R (recursive)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What does the command chgrp -R development test_dir do?

A

→ Changes the group owner of test_dir and everything inside it to development

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Which command displays a file’s ownership, permissions, and other detailed metadata?

A

stat

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Which command is used to change the user owner of a file or directory?

A

chown

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Can a regular user change the user ownership of their own file to another user?

A

→ No, only root can do this

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What does the command chown jane /tmp/filetest1 do?

A

→ Changes the user owner of /tmp/filetest1 to jane, keeping the group unchanged

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Which symbol can separate user and group in the chown command?
→ Either a colon (:) or a period (.)
23
How do you change both the user and group ownership using chown?
→ chown user:group file or chown user.group file
24
What does chown jane:users /tmp/filetest2 do?
→ Changes the user to jane and the group to users for /tmp/filetest2
25
Which command structure allows a regular user to use chown like chgrp to change just the group?
→ chown :group file or chown .group file
26
What is the effect of the command chown .users /tmp/filetest1 when run by user jane?
→ Changes the group owner of the file to users, keeping the user as jane
27
Which character indicates a regular file in ls -l output?
-
27
Which character represents a directory in ls -l output?
d
28
Which file type is indicated by the character l?
→ A symbolic link that points to another file
29
Which file type character indicates a block device file?
b
30
What file type is indicated by the character c in ls -l output?
→ A character device file
30
What does the file type character p represent?
→ A pipe file, used for communication between processes
31
What does the character s represent in the first position of ls -l output?
→ A socket file used for two-way process communication
32
What do characters 2–4 represent in the permissions string?
→ User owner's read, write, and execute permissions
33
What do characters 5–7 represent in the permissions string?
→ Group owner's permissions
34
What do characters 8–10 represent in the permissions string?
→ Others' (world's) permissions
35
Which directory is represented by drwxr-xr-x. 17 root root 4096 23:38 /?
→ The root (/) directory
36
Which file is represented by -rwxr-xr--. 1 bob bob 100 21:08 /data/abc.txt?
→ The file abc.txt located inside /data
36
True or False: Based on the following information the user bob can successfully execute the following command: more /data/abc.txt? drwxr-xr-x. 17 root root 4096 23:38 / dr-xr-x- -x. 10 root root 128 03:38 /data -rwxr-xr- -. 1 bob bob 100 21:08 /data/abc.txt
True – Bob can execute more /data/abc.txt because he has execute permission on the /data directory and read permission on the file.
36
Based on the following information, who can delete the /data/abc.txt file? drwxr-xr-x. 17 root root 4096 23:38 / drwxrw-rw-. 10 root root 128 03:38 /data -rwxr-xr--. 1 bob bob 100 21:08 /data/abc.txt
Only the root user. Only users with write and execute permissions on the parent directory (/data) can delete its contents — and only root has that power here.
37
True or False: Based on the following information the user bob can successfully execute the following command: more /data/abc.txt? drwxr-xr-x. 17 root root 4096 23:38 / dr-xr-x---. 10 sue payroll 128 03:38 /data -rwxr-xr--. 1 bob bob 100 21:08 /data/abc.txt
Not enough information to determine. Bob does not have execute permission on /data, so he cannot access any files inside it — even if he owns abc.txt. membership in payroll determines whether bob has that crucial execute (x) access.
37
True or False: Based on the following information the user bob can successfully execute the following command: more /data/abc.txt? drwxr-xr-x. 17 root root 4096 23:38 / dr-xr-x- -x. 10 root root 128 03:38 /data -rwxr-xr- -. 1 bob bob 100 21:08 /data/abc.txt
True. bob has execute permission on /data and read permission on the file.
38
Based on the following information, who can use the ls command to display the contents of the /data directory (ls /data)? drwxr-xr-x. 17 root root 4096 23:38 / drwxr-xr--. 10 root root 128 03:38 /data -rwxr-xr--. 1 bob bob 100 21:08 /data/abc.txt
All users. For a user to view the contents of a directory with ls, they only need the read (r) permission on that directory. However, they also need the execute (x) permission on all parent directories, in this case, /, to traverse through the path to get to /data.
39
In chmod ug+x,o-r abc.txt, what does o-r do?
→ Removes read permission from others
39
In chmod ug+x,o-r abc.txt, what does ug+x do?
→ Adds execute permission to the user owner and group owner
40
Which chmod command would remove all permissions from group and others, while keeping user owner permissions unchanged?
→ chmod go= abc.txt
41
What is the effect of the command chmod u=rx abc.txt?
→ Sets the user owner's permissions to read and execute only, removing write
42
Which command can show you the permissions of a file using both symbolic and octal methods?
The stat command
43
Which command is used to change permissions?
The chmod command
44
Which command is used to determine or display the default permissions mask for newly created files and directories?
umask
44
What are the maximum default permissions for a newly created file before applying umask?
→ rw-rw-rw- (octal: 666)
45
What are the maximum default permissions for a newly created directory before applying umask?
→ rwxrwxrwx (octal: 777)
45
If umask is 0022, what would be the default permissions for a newly created directory?
→ rwxr-xr-x
46
If umask is 0022, what would be the default permissions for a newly created file?
→ rw-r--r--
47
True or False: Based on the following information the user bob can successfully execute the following command: more /data/abc.txt? drwxr-xr-x. 17 root root 4096 23:38 / dr-xr-x---. 10 bob bob 128 03:38 /data ----rw-rwx. 1 bob bob 100 21:08 /data/abc.txt
False. Bob cannot execute more /data/abc.txt because he does not have execute permission on the /data directory.
48
Which command would you use to create a file named file1 in the directory named directory1 from outside the directory?
touch directory1/file1
49
Which command would you use to create an executable file with the content 'date' in the test.sh file within /tmp?
echo "date" > test.sh
50
Which ownership changing command can only be executed by the root user?
chown
50
Which command would you use to run an executable file?
./
51
Which ownership changing command can be used by the user who owns the file?
chgrp