Chapter 7 - Permission Management Flashcards

1
Q

Who are the different owners for a file or directory?

A

user
group
others

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

Who owns the file in terms of user, group owner when a new file is created?

A

Owners are set when a file or directory is created. On creation, the user who creates the file becomes the user owner, and the primary group of that user becomes the group owner

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

Which command can be used to check the current ownership permissions?

A

ls -l

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

Which command can be used to get a list of all files on the system that have a given user or group as the owner?

A

fine command with -user option

Example : find / -user linda

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

Which command is used to change a user and group ownership

A

chown - can be used to change both user and group ownership of a file
chgrp - can be used to change the group ownership

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

what is the syntax of chown command?

A

chown who what
example - chown linda account
changes the user ownership of the file account to linder user

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

Which option with chown, allows you to set ownership recursively, which allows you to set ownership
of the current directory and everything below

A

chown -R

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

when you change group ownership of a file or directory how to use chown command?

A

chown .account /home/account

so we use a . or : in front of the group name to identify that or indicate that itis a group.

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

What are the all possible ways to use chown command to change the user and group ownerships

A
chown lisa myfile
chown lisa.sales myfile
chown lisa:sales myfile
chown .sales myfile
chown :sales myfile
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to use chgrp command to change the group ownership?

A

following example, where you can use chgrp to set group ownership for the directory /home/account to the group account:
chgrp account /home/account

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

If the user is a member of more groups, how to change the effective primary group

A

groups command to view the active primary group membership of a user
newgrp command to change the effective primary group of a user

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

Which command to use to apply permissions?

A

chmod

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

What permission needed on a directory if you wanted to do anything inside of the directory?

A

execute

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

What are the numeric representation of the permissions?

A

Read 4
Write 2
Execute 1

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

Give an example of how the permissions can be modified relative to the current permissions?

A

chmod g+w,o-r somefile

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

What are the advanced file/directory permissions?

A

Set User ID (SUID)
Set Group ID (SGID)
sticky bit

17
Q

What is the set group id (SGID) permission?

A

This permission has two effects. If applied on an executable file, it gives the user who executes the file the permissions of the group owner of that file.
When applied to a directory, SGID may be useful, because you can use it to set default group ownership on files and subdirectories created in that directory.

18
Q

What is a sticky bit permission?

A

This permission is useful to protect files against accidental deletion in an environment where multiple users have write permissions in the same directory.
When you apply sticky bit, a user can delete files only if either of the following
is true:
1. The user is owner of the file.
2. The user is owner of the directory where the file exists.

19
Q

What is a sticky bit permission?

A

This permission is useful to protect files against accidental deletion in an environment where multiple users have write permissions in the same directory.
When you apply sticky bit, a user can delete files only if either of the following
is true:
1. The user is owner of the file.
2. The user is owner of the directory where the file exists.

20
Q

What are the numerical representation of advanced permissions suid, sgid and sticky bit?

A

SUID - 4, SGID - 2, and sticky bit - 1

21
Q

Give an example for setting SGID permission to a directory, and set rwx for user and rx for group and others

A

chmod 2755 /somedir

22
Q

How to apply any of the special permissions with relative mode?

A
  1. For SUID, use chmod u+s.
  2. For SGID, use chmod g+s.
  3. For sticky bit, use chmod +t
    followed by the name of the file or the directory
    that you want to set the permissions on
23
Q

What is disadv. of normal file permissions to ACLs?

A

File permissions does not allow you to give permissions to more than one user or one group on the same file.

24
Q

Which is the command used to create a backup of ACL and give an example?

A

getfacl command

Example : getfacl -R /directory > file.acls

25
Q

Which is the command to restore ACLs using the backup of ACLs?

A

setfacl command

Example : setfacl –restore=file.acls

26
Q

Does the output of ls -l show the ACLs applied to a file or directory?

A

No, it just shows a + after the listing of the permissions, which indicates that ACLs apply to the file or directory..

27
Q

Which command to use to see the current ACLs applied to a file or directory?

A

getfacl /dir

28
Q

What is the command to add an ACL to give read and execute permissions to the group sales owning the /dir?

A

setfacl -m g:sales:rx /dir

-m indicates we are modifying current ACL settings

29
Q

Which command to use to give permissions to user linda on the /data directory without making her the owner and without changing the current owner assignment.

A

setfacl -m u:linda:rwx /data

30
Q

What are the benefits of using default ACLs?

A

By setting a default ACL, you determine the permissions that will be set for all new items that are created in the directory.
Be aware, though, that a default ACL does not change the permissions for existing files and subdirectories. To change those as well you need to add a normal ACL besides a default ACL

31
Q

Which option is used with setfacl command to set it is a a default ACL?

A

d option. Example:

setfacl -m d:g:sales:rx /data

32
Q

How to use setfacl command If you want others not to get permissions on anything that is created
in /data?

A

setfacl -m d:o::- /data

33
Q

Which shell setting is used to determine the default file permissions?

A

umask
Example - The default umask setting of 022 gives 644 for all new files and 755 for all new directories that are created on your server.

Start with the default permissions for a file set to 666 and subtract the umask to get the effective permissions. For a directory, start with its default permissions that are set to 777 and subtract the umask to get the effective permissions.

34
Q

How the umask command works in determining the file permissions?

A

An easy way to see how the umask setting works is as follows: Start with the default permissions for a file set to 666 and subtract the umask to get the effective permissions. For a directory, start with its default permissions that are set to 777 and subtract the umask to get the effective permissions.
Example - The default umask setting of 022 gives 644 for all new files and 755 for all new directories that are created on your server.

35
Q

which command is used for user extended attributes?

A

If you want to apply attributes, you can use the chattr command. For example, use chattr +s somefile to apply the attributes to somefile. Need to remove the attribute
again? Then use chattr -s somefile and it will be removed. To get an overview of
all attributes that are currently applied, use the lsattr command.