Changing file, group ownership and chmod

Posted under » Linux on 18 May 2012

Check how many groups

cat /etc/group

List all the groups of which the current user is a member


To add a user to a specific group use

usermod -G name-of-group -a 'name-of-user'

Changing file ownership
Note.. CAPS may not work on some systems.

chown you some_file 

Please see mac version.

The group ownership of a file or directory

chgrp new_group some_file

You can do both chown and chgrp at the same time by.

chown lky:apache new_group some_file
chown lky:apache /var/some_folders/ -R

Where apache is the group and lky is the owner.


Note that linux commands are case sensitive. You cannot use CHMOD but only chmod will work.

chmod 600 some_file -R

Note do not chmod when you are root. Do it when you are owner.

Use the above for setting up Apache www folder permissions.

web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS IOT