Linux File Permissions - ArtTHEbard/SYS255FA19-Notes GitHub Wiki

Basic File Permissions

  • Permissions are: Read, Write, eXecute.
  • Permissions are displayed using ls -l, and are formatted [owner permissions][group permissions][other users permissions]
  • Permissions can be granted by setting the owner (chown 'user' /filepath), then using the command (chmod [u,g,o][+-]/filepath
  • The command ls -ld will list the owners and permissions for the directory.
  • The command ls -l will list the permissions for the contents of a directory.

Permission Lab

  • I first used the useradd command to create the Users: Alice, Fred, Bob.
  • I used the groupadd -g 1010 marketing and groupadd -g 1011 management commands to create the management and marketing groups.
  • I used the usermod command to modify the user files and add Bob and Fred to the marketing group, and Alice to the management group.
  • I used the command (chrgrp [selected group][directory/file to change]) to assign group permissions to the directories and files, and used the command (chmod [u,g,o][+-][/filepath] to edit the permissions for the groups.
  • Finally, to give the custom permissions to specific users, I used the chown command to assign ownership to the desired files, and the chmod command to assign the appropriate permissions.