Assignment 1.0: File Permissions & User Groups
Commands
Steps to create user and add to group
useradd example_user
= will add user of selected namepasswd example_user
= makes it so you can create password for usergroupadd example_group
= will create the new groupusermod -aG example_group example_user
= this will add user to a selected groupsu - example_user
= will become that userchgrp example_group /example_directory
= will apply the example_group to the example_directorychmod
= will allow you to change permission for file/directorychmod g+rwx /example_directory or file
= will allow the group permission to read, write, and executechomd g-rwx /example_directory or file
= will get rid of the ability to read, write, and execute for the group permissionsg
= is for groupo
= is for otherchomd g-rwx *
= all files in current directory will be effectedchomd -v num example_file
= will change permissions using binary to decimalnum is decimal number like '600' = for this the owner gets r and w (r+w = 6) and 0 means no permissions for the other sections
read = 100 (binary) = 4
write = 010 (binary) = 2
execute = 001 (binary) = 1
id
= shows what groups and uid for logged in userecho text >> /example_directory/example.txt
= will append text to example.txtecho text > /example_directory/example.txt
= will over write text to example.txt and or create file example.txt with text in it
Side notes
chown example_user example_file
= Will change the owner of the file to specified owner
List commands
ls
= shows directories in current directoryls -l /example
= will show all the files in directory * drwxr-xr-- owner group file/directory name * drwxrw-r-- owner group file/directory name * drwx-wxrw- owner group file/directory namels -ld /example
= listing directory instead of at the file level * example: drwx------ owner group directory name
drwxrwxrwx
= who can read write and exicutefirst 4 are the owner
next 3 are the group
last 3 are what others can do
drwx------ owner group file/directory name
only the owner would be able to see read write and exicute this file/directory
Last updated