Find code and diagrams at: https://www.EliTheComputerGuy.com
The commands chown and chmod allow you to change permissions and ownership of files and folders, but you also need to know the membership of groups to make sure permissions and ownership is appropriate.
View Group Membership
groups – shows groups you belong to
groups username – shows groups user belongs to
cat /etc/group | less – Allows you to view Group file that has all groups and members
members groupname – Shows members of a specific group
Members is not installed by default in Ubuntu. Install with: sudo apt-get install members
Change Ownership of Files and Folders
chown owner:group file – Changes Account Owner and Group Owner of File
chown :group file – Changes Group Owner of File
chwon -R owner:group folder – Changes Account Owner and Group Owner of Folder and changes contents recursively
Change Permissions
chmod 777 file – Changes permissions of file so that Account Owner can RWX, Group Owner can RWX, and Everyone can RWX
chmod -R 777 folder – Changes permissions of Folder and Contents so that Account Owner can RWX, Group Owner can RWX, and Everyone can RWX
-R is for recursive which means the contents of the folder will be changed also
Watch video Linux - Change Permissions and Ownership for Files and Folders (chmod, chown, members, groups ) online without registration, duration hours minute second in high quality. This video was added by user Eli the Computer Guy 19 September 2019, don't forget to share it with your friends and acquaintances, it has been viewed on our site 54,330 once and liked it 905 people.