Controlling File and Directory Permissions Flashcards

1
Q

How do you grant ownership of a file to another user?

A

With chown command
~~~
$ chown user file
~~~

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

How do you grant ownership of a file to a group?

A

With chgrp command
~~~
$ chgrp <group-name> <file>
~~~</file></group-name>

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

What are the default permissions for created files and directories?

A

666 for files and 777 for directories.

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

How can you change the default permissions in linux?

A

By editing the umask value in the /home/user/.profile file.

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

How does a umask works?

A

The umask has the same three bits, and its value is subtracted from the default ones. So if the umask value is set to 022, then the default permissions would be 644 for files and 755 for directories.

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

Is the umask value unique to all users of the system?

A

No, each user can have a personal umask value.

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

What are the three special permissions in linux?

A
  • Set user ID (SUID)
  • Set group ID (SGID)
  • Sticky bit
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the SUID permission? Describe a situation where it is used.

A

It’s a way of allowing an user to execute a file with the permissions of its owner. One possible situation is when an user wants to change his password. The SUID will grant him temporarily root privilleges to change the shadow file.

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

How do you set the SUID bit for a file?

A

By inserting the number 4 before the usual permissions, as in
~~~
$ chmod 4644 filename
~~~

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

True or False:

The permissions granted by SUID don’t extend beyond the use
of the file.

A

True.

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

What is the SGID permission?

A

The Set Group ID permission is a way of allowing an user to execute a file with the privilleges of the file owner’s group.

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

What happens when a directory has the SGID bit set?

A

Every file created in that directory will be own by the directory creator’s group rather than the file creator’s group.

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

How do you set the SGID bit for a file?

A

By inserting the number 2 before the usual permissions, as in
~~~
$ chmod 2644 filename
~~~

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

What command can be used to look for files starting from the root folder that belongs to the root user and have the SUID bit set?

A
$ find / -user root -perm -4000

or
~~~
$ find / -user root -perm -u=s
~~~

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