Linux exercise 6 - Users and groups

  1. Create regular users sulo and riku using useradd command (use options for creating home directory and sets bash as a default shell). Set passwords for both users. Then create users joonas and jani using adduser command.
  2. Create group called testers and add this group as a primary group for all users created in previous task. Verify this by creating a file with user jani and check the owner group. In addition, test commands id and groups for any of previously created users and for your own user. In what groups does your user belong to? Find out what is the purpose of these groups.
  3. Create group called coders and set it as the primary group for user joonas, but let joonas still be a member of testers group.
  4. Remove the user riku (remove also user's home directory) and remove also user jani without removing user's home directory. In addition, remove the group called coders.
  5. Lock the password for user sulo. Verify the changes. After this, set the password as expired and login with user sulo (remember to remove the password lock before login). What happens?
  6. Below is the presentation of a directory structure from fictional company including users from different groups. Create the presented directory structure, users and groups for the filesystem of your Ubuntu. Set file permissions for files and directories as described in the figure (Tip: use material from the next course title: File permissions). Verify that permissions work as intended and take screenshot from several different situations with different users. Important: Owner and group permissions can be set to be equal and other users should have permissions if needed (check the image for other permissions)! Owner and group for each object is presented with colored user icon. Linux exercise 6 directory structure