Unix Questions and Answers – Administrator Specific Commands and Privileges – 2

This set of Unix online test focuses on “Administrator Specific Commands and Privileges – 2”.

1. The SUID for any file can be set by the administrator using ____
a) chmod
b) chmod u+s filename
c) chmod s filename
d) chmod us filename
View Answer

Answer: b
Explanation: The SUID (set-user-ID) lets a process have the privileges of the owner of the file during the instance of the program. The SUID for any file can be set by the administrator using chmod command. For example,

# chod u+s  filename.

2. The superuser can set the sticky bit.
a) True
b) False
View Answer

Answer: a
Explanation: The sticky bit (also called the saved text bit) when applied to a regular file ensures that the text image of the program with the bit set is permanently kept in the swap area. The sticky bit also comes with a security feature when applied to directories. To apply the sticky bit to a directory superuser can use 1 as the additional bit with chmod in the following manner:

advertisement
advertisement
# chmod  1775  dirone
# ls  -l  a.txt
drwxrwxr-t  2     abd     dialin     2048   Apr 23  09:04   Dirone

3. Which of the following commands are used for the maintenance of user accounts?
a) useradd
b) usermod
c) userdel
d) useradd, usermod, userdel
View Answer

Answer: d
Explanation: For the creation and maintenance of user accounts, UNIX provides to the superuser three commands —useradd, usermod and userdel.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

4. _____ command is used for creating a new group.
a) chgrp
b) chown
c) addgrp
d) groupadd
View Answer

Answer: d
Explanation: groupadd command allows us to create a new group. For example, to create a group named OFFICEMANAG with a GID (group ID) of 398, use the following command:

groupadd -g 398  OFFICEMANAG

advertisement

5. For adding a new user to the system, we have to use ____ command.
a) grpadd
b) useradd
c) uadd
d) adduser
View Answer

Answer: b
Explanation: The useradd command is used to add new users to the system. Before using this command the super user should provide all the parameters related to the user in the command line itself. For example,

advertisement
# useradd  -u  134  -g  OFFICEMANAG  -c  “The RDMS”  -d  /home/group   -s   /bin/bash   -m group

6. All the user information is stored in _____
a) etc/passwd
b) bin/passwd
c) bin/users/passwd
d) etc/shadow
View Answer

Answer: a
Explanation: All the user information except the password encryption is stored in /etc/passwd. The encryption itself is stored in /etc/shadow. There are seven fields in /etc/passwd.

7. Which of the following is not a field stored in /etc/passwd?
a) username
b) password
c) UID, GID
d) encrypted password
View Answer

Answer: d
Explanation: The password encryption itself is stored in /etc/shadow while there are seven fields in /etc/passwd namely:
• Username
• Password
• UID
• GID
• GCOS
• HOME directory
• Login shell

8. Which command is used by the administrator to modify some parameters of existing users?
a) userdel
b) userchange
c) useradd
d) usermod
View Answer

Answer: d
Explanation: usermod command is used for modifying some parameters set with useradd. For example, sometimes users need to change their login shell, to do so root user will invoke the following command:

# usermod  -s  /bin/bash   oracle        //sets bash as the login shell for user oracle

9. userdel is used for removing users from the system.
a) True
b) False
View Answer

Answer: a
Explanation: We can remove users from the system using the userdel command. To remove a particular user from the system, use the following command:

# userdel  oracle    // remove user amed oracle from system but doesn’t delete his files

10. shutdown command is used by the administrator for shutting down the system.
a) True
b) False
View Answer

Answer: a
Explanation: The system administrator is also responsible for shutting down the system. For this purpose, shutdown command is used. This command performs various activities before shutting the system.

11. Which option is used with shutdown command to override the default waiting time?
a) -g
b) -e
c) -s
d) -i
View Answer

Answer: a
Explanation: -g option is used with shutdown command to override the default waiting time (one minute). For example,

shutdown  -g2            // shut down the machine after 2 minutes

12. Which one of the following command will shutdown and reboot the system?
a) shutdown -g2
b) shutdown -g2 i6
c) shutdown -g2 -g0
d) shutdown -y -g0 -i6
View Answer

Answer: d
Explanation: -y option is used with shutdown command for shutting the system immediately. Similarly, we can use the shutdown command to turn the machine off in various ways. To shut down and reboot the system, use the following command:

shutdown -y -g0 -i6.

13. Which command is used for reporting free space on the disk?
a) fd
b) df
c) du
d) sg
View Answer

Answer: b
Explanation: As we know that, UNIX OS is supported by various multiple file systems. The df (disk free) command reports the amount of space available for each file system separately.

14. ___ option is used with df command for displaying the total amount of disk space in the file system.
a) -a
b) -d
c) -t
d) -e
View Answer

Answer: c
Explanation: The -t (total) option when used with df command displays free space on each file system as well as the total amount of disk space in the file system.

15. ___ option is used with df command for displaying the total amount of disk space in the file system in terms of Kilobytes.
a) -a
b) -d
c) -t
d) -k
View Answer

Answer: d
Explanation: The df (disk free) command reports the amount of space available for each file system separately. -k option is used with df command for displaying the total amount of disk space in the file system in terms of Kilobytes.

Sanfoundry Global Education & Learning Series – Unix.

To practice all areas of Unix for online tests, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.