Sunday, May 12, 2024
9
rated 0 times [  9] [ 0]  / answers: 1 / hits: 39757  / 2 Years ago, fri, march 11, 2022, 12:00:39

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.


More From » command-line

 Answers
6

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.


[#25658] Saturday, March 12, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
byishted

Total Points: 469
Total Questions: 113
Total Answers: 113

Location: Tajikistan
Member since Sun, Aug 29, 2021
3 Years ago
;