Lesson 1 of 0
In Progress
Commands: w, whoami, sudo, su, & cat
Since I mention the `chown` command in this video, I think it’s probably important that I provide you some more details for your notes1. Change the owner of a file# chown [owner_name] [file_name]Example# chown root temp.txt2. Change the group of a file# chown :[group_name] [file_name]Example# chown :root temp.txt3. Change both owner and the group# chown [owner_name]:[group_name] [file_name]Example# chown root:root temp.txt4. Using chown command on symbolic link file# chown [owner_name]:[group_name] [file_symbolic_link]Example# chown root:root temp_symlnkwith -h flag change will be enforced# chown -h root:root temp_symlnkwith -R flag we can use chown against symbolic link directory# chown -R -H root:root temp_symlnk5. Change owner only if a file is owned by a particular user# chown --from=[owner_name] [new_owner_name] [file_name]Example# chown --from=root jenkins temp.txt6. Change group only if a file already belongs to a certain group# chown --from=:[group_name] :[new_group_name] [file_name]Example
# chown --from=:root :jenkins temp.txt7. Copy the owner/group settings from one file to another# chown --reference=[source_file] [destination_file]Example# chown --reference=settings.txt temp.txt8. Change the owner/group of the files by traveling the directories recursively# chown -R [user_name]:[group_name] [directory_name]/Example# chown -R jenkins:jenkins jenkins/9. List all the changes made by the chown command# chown -v -R [user_name]:[group_name] [file_name]Example# chown -v -R root:jenkins temp.txt