MCQ

Linux MCQs – File Access Rights and Permissions – Part 1

Multiple choice questions and answers (MCQs) on Linux focuses on “Managing of users accounts and groups” to prepare for exams, interviews, and certifications, such as Redhat exam, CompTIA exam, Ubuntu / SuSE certification, LPI certification exam. These MCQs will easily prepare anyone to pass their Linux test.
 

1. If a file has the following permissions 764 then _____?

A Everyone can read, the group can only execute and the owner can read and write

B Everyone can read and write, but only the owner can execute

C Everyone can read, the group and the owner can write, but only the owner can execute

D Everyone can read, the group can write and read and the owner can read, write and execute.
 

 
D
 

  • r = permission to read
  • w = permission to write
  • x = permission to run
  • – = 0 permission

With r=4 / w=2 / x=1

 

 

2. What is the octal representation of these -rwx r-s r– permissions?

A 0777

B 2766

C 2744

D 2754

D

When the “Set Group ID” bit is set, the executable is run with the authority of the group. For example, if a file belongs to the user group, regardless of who executed it, it would always run with the user’s group authority. Use the chmod command to set the SGID on file1.txt. The octal value is 2000 and the symbolic value is “s”.

String notation:

$ chmod g+s file1.txt

 
Numeric notation:

$ chmod 2750 file1.txt

 

 

3. What is the octal representation of these -rwS r–- r–- permissions?

A 0777

B 2666

C 4744

D 4644

D
 

SUID is a special permission assigned to a file. These permissions allow the file to run with the privileges of the owner. For example, if a file was owned by the root user and the SUID bit was set, no matter who executed the file, it would always execute with the privileges of the root user. To set the SUID on a file, the octal value is 4000 and the symbolic value is “s”.

Run the following command to set the SUID bit:

$ chmod u+s file1

 
Display the details with the following command ls -l:

$ ls -l file1

-rwSrw-r-- 1 user1 user1 0 2018-10-29 21:41 file1

 

 

4. The sticky bit can be defined using the following permission.

A 0777

B 2666

C 4744

D 1755
 

 
D
The sticky bit ($chmod +t file-name) was introduced for use with executables to allow an operating system to keep the program’s text segment in swap space after the process has finished. It was a performance feature designed to speed up program execution. The sticky bit is most commonly used on directories where it allows files or directories to be moved or deleted only by the owner of that object, the owner of the directory or the root superuser. To define the sticky bit on a file, the octal value is 1000 and the symbolic value is “t”.
Symbolically:

$ chmod o+t file1.txt

 
Numeric notation:

$ chmod 1755 file1.txt

 
The sticky bit has no effect if other does not have execution permissions. The sticky bit is represented with a lowercase “t” in the output of ls. When it has no effect, it is represented by a capital “T”.

$ ls -l file1

-rwxr-xr-t 1 user1 user1 0 2018-10-29 21:41 file1

 

 

5. Effective Group ID (EGID) can be defined with the following permission _____ ?

A 0777

B 2666

C 4744

D 1755

B
EGID allows access control and may also allow file creation depending on the semantics of the specific kernel implementation used.

 

 

6. Effective User ID (EUID) can be defined with the following permission _____?

A 0777

B 2666

C 4744

D 1755

C
EUID of a process is used in most cases for access controls.

 

 

7. -rwxr–r– permissions represented by the following octal value _____

A 777

B 666

C 744

D 711

C
 

  • r = permission to read
  • w = permission to write
  • x = permission to run
  • – = 0 permission

With r=4 / w=2 / x=1

 

 

8. What is the command to grant execution permission on all files and subdirectories in “/home/document/mydirectory”

A $ chmod –r +x /home/document/mydirectory

B $ chmod –R +x /home/document/mydirectory

C $ chmod –f –r +x /home/document/mydirectory

D $ chmod –F +x /home/document/mydirectory
 

 
B
To change the permissions on all files and subdirectories of “/home/document/mydirectory” we use “chmod” command with the option -R:

$ chmod –R +x /home/document/mydirectory

 

 

9. If the “umask” value = “0002”. What will be the permissions of the newly created directory?

A 777

B 775

C 774

D 664

B

 

 

10. A user runs “chmod” on a file. Which of the following statements is true?

A The access date of the file is updated

B The modification date of the file is updated

C The file change date is updated

D None of the above

B
When you run the “chmod” command on a file the modification date is updated.

 

 
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *