Ubuntu – Change group access to directory and all sub directories and files

command linepermissions

There is root ownership and root group applied to /media/pandya/Ext4/* ("pandya" is user-name). To apply group "pandya" I run following command:

 sudo chown -hR root:pandya /media/pandya/Ext4/*

Now, There is root ownership and "pandya" group applied to /media/pandya/Ext4 and all sub files and directories.

But group "pandya" has only permission "Access files" (for directories) and "Read Files" (for files) for all sub directories and files.

So, How to apply full permissions ("create and delete files" to directories and "read and write" to files) to group "pandya" ? So-that I can fully access /media/pandya/Ext4/
and all sub directories and folders with "pandya" group.

Best Answer

The chown command is to change user and group ownership, to change permissions, you need chmod. So, once you have set the group ownership to pandya using chown as you have, change the permissions to give the group write access:

chmod -R g+w /media/pandya/Ext4/

From man chmod:

The format of a symbolic mode is [ugoa...][[+-=][perms...]...], where perms is either zero or more letters from the set rwxXst, or a single letter from the set ugo. Multiple symbolic modes can be given, separated by commas.

A combination of the letters ugoa controls which users' access to the file will be changed: the user who owns it (u), other users in the file's group (g), other users not in the file's group (o), or all users (a). If none of these are given, the effect is as if a were given, but bits that are set in the umask are not affected.

The operator + causes the selected file mode bits to be added to the existing file mode bits of each file; - causes them to be removed; and = causes them to be added and causes unmentioned bits to be removed

-R, --recursive

change files and directories recursively

So, g+w means "give users that belong to the file's group write access" and -R means apply to all files and subdirectories recursively.