Week 4: Linux File Permissions: - ConnorEast/Tech-Journal GitHub Wiki

Linux File Permissions:


How to create a user:
to create a user you must first know the name of the person you are making the account for and the password that will be assigned to their account. Once both of those have been completed you should use the following commands

  1. To create the user use "sudo useradd (usersName)"
  2. To change the password you would use the "sudo passwd (userName)"\ ** How to create groups:**
    To create a group first figure out what groups need to be created for your specific purpose. For example if you need to make a folder for your marketing department you will likely want the name of your group to be marketting.
  3. Creating a group is simple. All you do is use the following command "sudo groupadd (groupName)"\
  • Adding Users to a Group:
    To add a user to a group is slightly trickier but still relatively simple as shown in the following step. The main thing to note is you should have both a group created and the account in which you want to add to the group created. For the example below I will use Alice as the individuals account and Management for the group account.
  1. "usermod -aG management alice"
    usermod stands for [user modify],aG stands for [add to group], management is the group and alice is the individual.\ Adjusting a directories RWX permissions:
    First choose a directory you would like to change the permissions of. Then choose which permission you want each sects to use.
  • ** chmod u+rwx /accounting**

This command adds read write and execute commands for the owner of the accounting directory\

  • ** chmod u-rwx /accounting**

This command removes read write and execute commands for the owner of the accounting directory\

  • ** chmod g+rwx /accounting**

This command adds read write and execute commands for the group attached to the accounting directory\

  • chmod g-rwx /accounting

This command removes read write and execute commands for the group attached to the accounting directory\

  • ** chmod o+rwx /accounting**

This command adds read write and execute commands for others attached to the accounting directory\

  • ** chmod o-rwx /accounting**

This command removes read write and execute commands for others attached to the accounting directory\