250+ TOP MCQs on Changing File Ownership and Permissions

Unix Multiple Choice Questions on “Changing File Ownership and Permissions”.

1. Which command is used to change the permissions of a file?
a) chmod
b) ch
c) chown
d) chgrp

Answer: a
Clarification: The chmod (change mode) command is used to change the permissions of files. This command can only be run by the owner of the file or by the super user.

2. chmod command can take multiple filenames as arguments.
a) True
b) False

Answer: a
Clarification: We can change permissions of multiple files by using chmod command once. To change permissions of multiple files simultaneously just use the chmod command with multiple filenames as arguments.

3. chmod command can be used in ____ ways.
a) 3
b) 2
c) 5
d) 0

Answer: b
Clarification: chmod command can be used in two manners i.e. relative (changes are specified to the current permissions) and absolute (final permissions are specified).

4. The expression used with chmod command to change permissions in a relative manner contains ____ components.
a) 5
b) 2
c) 4
d) 3

Answer: d
Clarification: chmod command takes an expression as its arguments which comprises of some letters and symbols. The expression comprises three components:-
-> User category (user, group, others)
-> The operation to be performed (assign or remove a permission)
-> Type of permission (read, write, execute).

5. Which of the following characters specify the user and group category?
a) ‘u’ and ‘g’
b) ‘g’ and ‘o’
c) ‘us’ and ‘gr’
d) ‘u’ and ‘o’

Answer: a
Clarification: Each character specifies a particular category of users as follows:
‘u’ stands for a user,
‘g’ for ‘group’
‘o’ for ‘others’.

6. Which of the following symbol is used with chmod to assign permission to a file?
a) –
b) /
c) +
d) *

Answer: c
Clarification: To assign and remove permissions from a file, (+) and (-) symbols are used respectively.
‘+’ symbol will assign a permission
‘-‘ symbol will remove a permission

7. To assign execute permission to the user (owner) for a file named file01.txt, which of the following command will be used?
a) chmod u+r file01.txt
b) chmod u+w file01.txt
c) chmod u-x file01.txt
d) chmod u+x file01.txt

Answer: d
Clarification: To assign execute permission to the user, above command is stated as follows:

 u    -  for specifying the category of user.
 +    - for assigning permission.
 x    - to specify execute permission.

8. What does the following command do?

     $ chmod ugo +w  file01.txt

a) assign write permission to users, group and others
b) assign write permission to the user (owner) only
c) assign write permission to group and others
d) command not executable

Answer: a
Clarification: The string ugo combines all the three categories –user, group and others while (+) is used to assign the permission. ‘w’ specifies the write operation.

9. Which character is used to replace ‘ugo’ string in chmod command?
a) a
b) v
c) x
d) o

Answer: a
Clarification: UNIX offers a shorthand symbol ‘a’ (all) that acts as a synonym for the ‘ugo’ string which represents all the categories of users.

$ chmod a+w  file01		// assign write permission to user, group and others.

10. To remove write permission from group and others, which one of the following commands will be used?
a) chmod go+w file01
b) chmod go-w file01
c) chmod ug-w file01
d) chmod a-w file01

Answer: b
Clarification: To remove a certain permission from a category of users we use (-) symbol. So above command will remove write permission from group and others.

Leave a Reply

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