Platform: CentOS7 1. Set up a shared group environment. Create two directories:
ID: 3819462 • Letter: P
Question
Platform: CentOS7
1. Set up a shared group environment. Create two directories: /data/account and
/data/sales. Make the group sales owner of the directory sales, and make the group
account owner of the directory account.
2. Configure the permissions so that the user owner (which must be root) and group
owner have full access to the directory. There should be no permissions assigned to the
others entity. Also, make sure that “others” will get no permissions on newly created files
and directories within the entire /data structure.
3. Create a configuration that allows members of the group sales read files in the
directory /data/account. Also, make sure that members of the group account have read
permissions in the directory /data/sales.
4. Ensure that all new files in both directories inherit the group owner of the /data/sales
and /data/account directory. This means that all files that will be created in /data/sales
will be owned by the group sales, and all files in /data/account will be owned by the
group account.
5. Ensure that users are only allowed to remove files of which they are the owner.
Explanation / Answer
Basically we create directories and files in Unix and Linux environment.Let's see step by step
1)first of all,we need to create 2 directories as below:
mkdir /data/acccount
mkdir /data/ sales
Now let's change the ownership to group by the command below:
chgrp {-R} [group] [/data/account/]
chgrp {-R} [group] [/data/sales/]
Where chgrp denotes change group that changes the group of the file.
2)Now let's assign all permissions to users and group without assigning any permissions to others which can be achieved by following commands:
chmod ug=rwx,o-rwx /data/account/
chmod ug=rwx,o-rwx / data/sales/
3)Now we 'll assign group read permission that can able to read the contents of directory:
chmod g+r /data/account
chmod g+r /data/sales
4) now we 'll see inherit permissions of parent directory when a file is created inside it can be achieved by the following command:
chmod g+s /path/to/parent
If we use this command ,newly created file can inherit its parent's access permissions by providing parent path in /path/to/parent place
5)users can remove files by using rm command as below:
rmdir -r /data/account
rmdir -r /data/sales
Where -r recursively deletes from child file to parent directory. if we do not use -r ,rmdir dir will remove directory only if it is empty.