File Permissions - jacob-dinapoli/tech-journal GitHub Wiki

  • Creating Groups
    • In order to create a new group type, simply type the following command:
      • groupadd GROUPNAME
    • This command adds an entry for the new group to the /etc/group and /etc/gshadow files
    • Once the group is created, you can start adding users to the group.
  • Adding Users to Groups
    • In order to add a user to a group, simply type the following command:
      • usermod -a -G GROUPNAME USERNAME
    • The -a option tells usermod that we are appending
    • The -G option tells usermod we are appending to the group name that follows the option.
    • In order to tell which user are already a member of a group, type the following command:
      • grep GROUPNAME /etc/group
  • Adjusting rwx directory
    • In order to change directory permissions in bash, type the following command:
      • chmod +rwx FILENAME (to add permissions)
      • chmod -rwx DIRECTORYNAME (to remove permissions)
      • chmod +x FILENAME (to allow executable permissions)
      • chmod -wx FILENAME (to take out write and executable permissions)
    • The command for changing directory permissions for group owners are of the following:
      • chmod g+w FILENAME
      • chmod g-wx FILENAME
      • chmod o+w FILENAME
      • chmod o-rwx FOLDERNAME
    • In order to change ownership of files and directories, use the following command: * chown USERNAME FILENAME * chown USERNAME FOLDERNAME