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 notes
1. Change the owner of a file
# chown [owner_name] [file_name]
# chown root temp.txt
2. Change the group of a file
# chown :[group_name] [file_name]
# chown :root temp.txt
3. Change both owner and the group
# chown [owner_name]:[group_name] [file_name]
# chown root:root temp.txt
4. Using chown command on symbolic link file
# chown [owner_name]:[group_name] [file_symbolic_link]
# chown root:root temp_symlnk
with -h flag change will be enforced
# chown -h root:root temp_symlnk
with -R flag we can use chown against symbolic link directory
# chown -R -H root:root temp_symlnk
5. Change owner only if a file is owned by a particular user
# chown --from=[owner_name] [new_owner_name] [file_name]
# chown --from=root jenkins temp.txt
6. Change group only if a file already belongs to a certain group
# chown --from=:[group_name] :[new_group_name] [file_name]
# chown --from=:root :jenkins temp.txt
7. Copy the owner/group settings from one file to another
# chown --reference=[source_file] [destination_file]
# chown --reference=settings.txt temp.txt
8. Change the owner/group of the files by traveling the directories recursively
# chown -R [user_name]:[group_name] [directory_name]/
# chown -R jenkins:jenkins jenkins/
9. List all the changes made by the chown command
# chown -v -R [user_name]:[group_name] [file_name]
# chown -v -R root:jenkins temp.txt