UNIX MCQs – User Accounts (Part – 2)

UNIX Question and Answer – User Account Management

UNIX MCQ – Multiple Choice Questions for exam, interview, and Entrance Test

1. What command is used to display the default values for creating a new user account in UNIX?

a) userdefaults

b) defaultuser

c) useradd -D

d) newuser -defaults

Answer: c) useradd -D

Explanation: The useradd -D command is used to display the default values for creating a new user account in UNIX.


2. Which option is used with the useradd command to specify the expiration date for a new user account?

a) -e

b) -expire

c) -expiry

d) -expires

Answer: a) -e

Explanation: The -e option with the useradd command is used to specify the expiration date for a new user account.


3. What command is used to create a new group in UNIX?

a) groupadd

b) addgroup

c) newgroup

d) creategroup

Answer: a) groupadd

Explanation: The groupadd command is used to create a new group in UNIX.


4. Which option is used with the usermod command to add a user to multiple groups simultaneously?

a) -G

b) -addGroup

c) -group

d) -add

Answer: a) -G

Explanation: The -G option with the usermod command is used to add a user to multiple groups simultaneously in UNIX.


5. What command is used to remove a user from a group in UNIX?

a) removeuser

b) delgroup

c) groupdel

d) userdel -G

Answer: d) userdel -G

Explanation: The userdel -G command is used to remove a user from a group in UNIX.


6. Which option is used with the chsh command to change the user’s login shell?

a) -s

b) -shell

c) -login

d) -change

Answer: a) -s

Explanation: The -s option with the chsh command is used to change the user’s login shell in UNIX.


7. What command is used to change the primary group of a user in UNIX?

a) primarygroup

b) usergroup

c) chgrp

d) usermod -g

Answer: d) usermod -g

Explanation: The usermod -g command is used to change the primary group of a user in UNIX.


8. Which option is used with the useradd command to specify the initial login group for a new user?

a) -l

b) -login

c) -g

d) -group

Answer: c) -g

Explanation: The -g option with the useradd command is used to specify the initial login group for a new user.


9. What command is used to display the group membership of a user in UNIX?

a) showgroups

b) groups

c) usergroups

d) getent passwd

Answer: b) groups

Explanation: The groups command is used to display the group membership of a user in UNIX.


10. Which option is used with the chage command to set the maximum number of days a password is valid?

a) -M

b) -maxdays

c) -max

d) -expiry

Answer: b) -maxdays

Explanation: The -maxdays option with the chage command is used to set the maximum number of days a password is valid.


11. What command is used to display the current password aging policies for a user account in UNIX?

a) passwd -aging

b) chage

c) aging

d) getpass

Answer: b) chage

Explanation: The chage command is used to display the current password aging policies for a user account in UNIX.


12. Which option is used with the chage command to set the date of the last password change for a user?

a) -l

b) -last

c) -lastchange

d) -password

Answer: c) -lastchange

Explanation: The -lastchange option with the chage command is used to set the date of the last password change for a user.


13. What command is used to display the details of a specific group in UNIX?

a) groupinfo

b) getent group

c) id

d) cat /etc/group

Answer: b) getent group

Explanation: The getent group command is used to display the details of a specific group in UNIX.


14. Which option is used with the usermod command to set the expiration date for a user account?

a) -e

b) -expires

c) -expiry

d) -expire

Answer: a) -e

Explanation: The -e option with the usermod command is used to set the expiration date for a user account.


15. What command is used to display the group ID (GID) associated with a group name in UNIX?

a) getent group

b) id

c) groups

d) grep

Answer: a) getent group

Explanation: The getent group command is used to display the group ID (GID) associated with a group name in UNIX.


16. Which option is used with the usermod command to set the user’s login shell?

a) -login

b) -shell

c) -s

d) -change

Answer: c) -s

Explanation: The -s option with the usermod command is used to set the user’s login shell.


17. What command is used to display information about system users in UNIX?

a) showusers

b) getent passwd

c) id

d) cat /etc/passwd

Answer: b) getent passwd

Explanation: The getent passwd command is used to display information about system users in UNIX.


18. Which option is used with the chsh command to specify the new login shell for a user?

a) -s

b) -shell

c) -new

d) -change

Answer: a) -s

Explanation: The -s option with the chsh command is used to specify the new login shell for a user.


19. What command is used to assign a password to a user account in UNIX?

a) passwd

b) setpass

c) addpass

d) modpass

Answer: a) passwd

Explanation: The passwd command is used to assign a password to a user account in UNIX.


20. Which option is used with the chage command to set the minimum number of days required between password changes?

a) -m

b) -mindays

c) -min

d) -minpass

Answer: b) -mindays

Explanation: The -mindays option with the chage command is used to set the minimum number of days required between password changes.


21. What command is used to display the user ID (UID) associated with a username in UNIX?

a) getent passwd

b) id

c) whoami

d) user

Answer: a) getent passwd

Explanation: The getent passwd command is used to display information about user accounts, including the user ID (UID) associated with a username.


22. Which option is used with the usermod command to add a user to multiple groups simultaneously?

a) -G

b) -addGroup

c) -group

d) -add

Answer: a) -G

Explanation: The -G option with the usermod command is used to add a user to multiple groups simultaneously in UNIX.


23. What command is used to remove a user from a group in UNIX?

a) removeuser

b) delgroup

c) groupdel

d) userdel -G

Answer: d) userdel -G

Explanation: The userdel -G command is used to remove a user from a group in UNIX.


24. Which option is used with the chsh command to change the user’s login shell?

a) -s

b) -shell

c) -login

d) -change

Answer: a) -s

Explanation: The -s option with the chsh command is used to change the user’s login shell in UNIX.


25. What command is used to change the primary group of a user in UNIX?

a) primarygroup

b) usergroup

c) chgrp

d) usermod -g

Answer: d) usermod -g

Explanation: The usermod -g command is used to change the primary group of a user in UNIX.


26. What command is used to lock a user account in UNIX?

a) lockuser

b) userlock

c) passwd -l

d) usermod -l

Answer: c) passwd -l

Explanation: The passwd -l command is used to lock a user account in UNIX.


27. Which option is used with the passwd command to disable password aging for a user account?

a) -n

b) -noage

c) -disable

d) -agingoff

Answer: c) -disable

Explanation: The -disable option with the passwd command is used to disable password aging for a user account.


28. What command is used to display the expiration date of a user account in UNIX?

a) expdate

b) userexpire

c) chage -l

d) usermod -l

Answer: c) chage -l

Explanation: The chage -l command is used to display the expiration date of a user account in UNIX.


29. Which option is used with the chage command to set the date of the last password change for a user?

a) -last

b) -lastchange

c) -lc

d) -pwdchange

Answer: b) -lastchange

Explanation: The -lastchange option with the chage command is used to set the date of the last password change for a user.


30. What command is used to display the group ID (GID) associated with a group name in UNIX?

a) getent group

b) id

c) groups

d) grep

Answer: a) getent group

Explanation: The getent group command is used to display the group ID (GID) associated with a group name in UNIX.


31. Which option is used with the usermod command to change the user’s primary group?

a) -p

b) -primarygroup

c) -pg

d) -g

Answer: d) -g

Explanation: The -g option with the usermod command is used to change the user’s primary group in UNIX.


32. What command is used to display the password aging information for a user account in UNIX?

a) passwd -aging

b) chage

c) aginginfo

d) pwdaging

Answer: b) chage

Explanation: The chage command is used to display the password aging information for a user account in UNIX.


33. Which option is used with the chage command to set the maximum number of days before a password must be changed?

a) -max

b) -maxdays

c) -d

d) -days

Answer: b) -maxdays

Explanation: The -maxdays option with the chage command is used to set the maximum number of days before a password must be changed.


34. What command is used to assign a password to a user account in UNIX?

a) passwd

b) setpass

c) addpass

d) modpass

Answer: a) passwd

Explanation: The passwd command is used to assign a password to a user account in UNIX.


35. Which option is used with the chage command to set the minimum number of days before a password can be changed?

a) -m

b) -mindays

c) -d

d) -min

Answer: b) -mindays

Explanation: The -mindays option with the chage command is used to set the minimum number of days before a password can be changed.


36. What command is used to set the expiration date for a user account in UNIX?

a) expire

b) userexpire

c) passwd -e

d) usermod -e

Answer: d) usermod -e

Explanation: The usermod -e command is used to set the expiration date for a user account in UNIX.


37. Which option is used with the usermod command to specify the expiration date for a user account?

a) -e

b) -expire

c) -d

d) -date

Answer: a) -e

Explanation: The -e option with the usermod command is used to specify the expiration date for a user account.


38. What command is used to display the details of a specific group in UNIX?

a) groupinfo

b) getent group

c) id

d) cat /etc/group

Answer: b) getent group

Explanation: The getent group command is used to display the details of a specific group in UNIX.


39. Which option is used with the usermod command to set the expiration date for a user account?

a) -e

b) -expires

c) -expiry

d) -expire

Answer: a) -e

Explanation: The -e option with the usermod command is used to set the expiration date for a user account.


40. What command is used to display the group ID (GID) associated with a group name in UNIX?

a) getent group

b) id

c) groups

d) grep

Answer: a) getent group

Explanation: The getent group command is used to display the group ID (GID) associated with a group name in UNIX.


41. Which option is used with the usermod command to set the user’s login shell?

a) -login

b) -shell

c) -s

d) -change

Answer: c) -s

Explanation: The -s option with the usermod command is used to set the user’s login shell in UNIX.


42. What command is used to display information about system users in UNIX?

a) showusers

b) getent passwd

c) id

d) cat /etc/passwd

Answer: b) getent passwd

Explanation: The getent passwd command is used to display information about system users in UNIX.


43. Which option is used with the chsh command to specify the new login shell for a user?

a) -s

b) -shell

c) -new

d) -change

Answer: a) -s

Explanation: The -s option with the chsh command is used to specify the new login shell for a user.


44. What command is used to assign a password to a user account in UNIX?

a) passwd

b) setpass

c) addpass

d) modpass

Answer: a) passwd

Explanation: The passwd command is used to assign a password to a user account in UNIX.


45. Which option is used with the chage command to set the minimum number of days required between password changes?

a) -m

b) -mindays

c) -min

d) -minpass

Answer: b) -mindays

Explanation: The -mindays option with the chage command is used to set the minimum number of days required between password changes.


46. What command is used to display the user ID (UID) associated with a username in UNIX?

a) getent passwd

b) id

c) whoami

d) user

Answer: a) getent passwd

Explanation: The getent passwd command is used to display information about user accounts, including the user ID (UID) associated with a username.


47. Which option is used with the usermod command to add a user to multiple groups simultaneously?

a) -G

b) -addGroup

c) -group

d) -add

Answer: a) -G

Explanation: The -G option with the usermod command is used to add a user to multiple groups simultaneously in UNIX.


48. What command is used to remove a user from a group in UNIX?

a) removeuser

b) delgroup

c) groupdel

d) userdel -G

Answer: d) userdel -G

Explanation: The userdel -G command is used to remove a user from a group in UNIX.


49. Which option is used with the chsh command to change the user’s login shell?

a) -s

b) -shell

c) -login

d) -change

Answer: a) -s

Explanation: The -s option with the chsh command is used to change the user’s login shell in UNIX.


50. What command is used to change the primary group of a user in UNIX?

a) primarygroup

b) usergroup

c) chgrp

d) usermod -g

Answer: d) usermod -g

Explanation: The usermod -g command is used to change the primary group of a user in UNIX.

Related Articles

Linux MCQ

Welcome to Linux Multiple Choice Questions (MCQ) Section Embark on a journey through the world of...