How to manage users and groups in linux

Here are the 50 practical scenarios on how to manage users and groups that can help you prepare for the RHSA (Red Hat Certified System Administrator) exam:

User Management:

1. Create a new user named “john.”

2. Set a password for the user “john.”

3. Configure password expiration for “john” to require a change on the next login.

4. Create a user named “jane” with a specific UID.

5. Create a user account without a home directory.

6. Lock and unlock a user account.

7. Set the user “john” to have no password.

8. Delete a user account and their home directory.

9. View detailed information about a user using “id.”

10. Change the default shell for a user.

11. Change the home directory for a user.

12. Modify a user’s login shell using “chsh.”

13. Display the list of all users on the system.

Group Management:

14. Create a new group named “developers.”

15. Add a user to the “developers” group.

16. Remove a user from a specific group.

17. Rename a group from “sales” to “marketing.”

18. List all groups on the system.

19. Display group membership for a specific user.

20. Create a group without specifying a GID.

21. Remove an empty group.

22. Change the primary group of a user.

23. Add a user to multiple groups.

Password Policies:

24. Set password policies to require complex passwords.

25. Configure password aging for user accounts.

26. Set password expiration for a specific user.

27. Prevent a user from changing their password.

28. Display the password policy settings.

29. Remove password aging for a user.

Authentication:

30. Enable password-based authentication in SSH.

31. Configure SSH to allow key-based authentication for a specific user.

32. Disable root login via SSH.

33. Configure “sshd_config” to use a custom port for SSH.

34. Set up LDAP authentication for system users.

35. Implement two-factor authentication for SSH login.

User and Group File Permissions:

36. Create a new file and assign specific ownership.

37. Modify file permissions to allow group members to write to a file.

38. Restrict access to a directory for a specific group.

39. Grant read and write permissions to a user on a file.

40. Display and interpret the output of “ls -l” for a file.

41. Change the ownership of a file without modifying permissions.

42. Use the “chown” command recursively on a directory.

43. Set the setgid bit on a directory.

44. Implement Access Control Lists (ACLs) on a file.

User and Group Management Tools:

45. Use the “useradd” command to create a user.

46. Manage user accounts using the “passwd” command.

47. Modify user properties with the “usermod” command.

48. Delete a user account using the “userdel” command.

49. Create a group with the “groupadd” command.

50. Manage groups with the “groupmod” and “groupdel” commands.

Note : These scenarios cover a wide range of tasks related to managing users and groups in a Linux environment. Practice these tasks on a Red Hat-based system to prepare for the RHSA exam and real-world user and group management challenges.