Linux Assignment– 3

User and Group Permissions

Basic Questions

  1. Create a new user named ‘testuser’.
  2. Set a password for ‘testuser’.
  3. Create a new group named ‘testgroup’.
  4. Add ‘testuser’ to ‘testgroup’.
  5. Display all users on the system.
  6. Display all groups on the system.
  7. Check the groups a user belongs to.
  8. Change the primary group of a user.
  9. Create a file and change its ownership to ‘testuser’.
  10. Change the group ownership of a file to ‘testgroup’.
  11. Display the ownership and permissions of a file.
  12. Change file permissions to read-only for all users.
  13. Give execute permission to a script for the owner only.
  14. Remove write permission from a file for the group.
  15. Create a directory and set permissions to 755.
  16. Create a file and set permissions to 644.
  17. Use ‘chmod’ to modify file permissions.
  18. Use ‘chown’ to change file ownership.
  19. Use ‘chgrp’ to change group ownership.
  20. Check the default permissions of newly created files.

Intermediate Questions

  1. Create a user with a specific home directory.
  2. Create a group and assign multiple users to it.
  3. Set a user’s shell to /bin/bash.
  4. Lock and unlock a user account.
  5. Create a shared directory for a group with proper permissions.
  6. Set a file to be executable only by group members.
  7. Use ‘usermod’ to modify user details.
  8. Use ‘groupmod’ to rename a group.
  9. Delete a user and remove their home directory.
  10. Delete a group from the system.
  11. Set a file to be accessible only by the owner.
  12. Create a directory with sticky bit set.
  13. Set a file with setuid permission.
  14. Set a file with setgid permission.
  15. Create a cron job for a user.
  16. Audit user login history.
  17. Restrict access to a file using ACLs.
  18. Grant read access to a file for a specific user using ACLs.
  19. Remove ACL permissions from a file.
  20. Check ACL settings of a file.

Advanced Questions

  1. Write a script to create multiple users and assign them to a group.
  2. Automate permission setting for a directory structure.
  3. Configure sudo access for a user.
  4. Restrict command execution using sudoers file.
  5. Monitor user activity using auditd.
  6. Set up a secure file sharing environment using groups and permissions.
  7. Create a script to backup user home directories.
  8. Implement user quota management.
  9. Configure PAM for password policies.
  10. Write a script to check and report permission issues in a directory.