Assignment 1.0: File Permissions & User Groups
Last updated
Last updated
useradd example_user
= will add user of selected name
passwd example_user
= makes it so you can create password for user
groupadd example_group
= will create the new group
usermod -aG example_group example_user
= this will add user to a selected group
su - example_user
= will become that user
chgrp example_group /example_directory
= will apply the example_group to the example_directory
chmod
= will allow you to change permission for file/directory
chmod g+rwx /example_directory or file
= will allow the group permission to read, write, and execute
chomd g-rwx /example_directory or file
= will get rid of the ability to read, write, and execute for the group permissions
g
= is for group
o
= is for other
chomd g-rwx *
= all files in current directory will be effected
chomd -v num example_file
= will change permissions using binary to decimal
num 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 user
echo text >> /example_directory/example.txt
= will append text to example.txt
echo 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
ls
= shows directories in current directory
ls -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 name
ls -ld /example
= listing directory instead of at the file level * example: drwx------ owner group directory name
drwxrwxrwx
= who can read write and exicute
first 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