Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This assignment deals with Unix file protections. Set the protections on the dir

ID: 3871617 • Letter: T

Question

This assignment deals with Unix file protections. Set the protections on the directories and files that you created for the earlier “Files and Directories” assignment as follows: ~/UnixCourse You should be able to add and remove files from the directory, access files within the directory whose names you already know, and look through the directory via ls to see what files are in there. No one else should be able to do any of these things. (This is a good setting for directories where you will keep assignments for various courses. After this assignment, your ~/UnixCourse directory should always be set this way.) ~/UnixCourse/fileAsst You should be able to add and remove files from the directory, access files within the directory whose names you already know, and look through the directory via ls to see what files are in there. People in your group should be able to do ls and to access files, but not add/remove files from the directory. People outside your group should be able to do none of these things. (Actually, no one but you will really have access to this directory because it’s inside ~/UnixCourse and, if you’ve done the prior step correctly, they can’t get inside there to get to fileAsst. But, for the sake of this exercise, we’ll ignore that fact.) ~/UnixCourse/fileAsst/TweedleDee You should be able to add and remove files from the directory, access files within the directory whose names you already know, and look through the directory via ls. Everyone else should be able to use ls but have no other privileges. ~/UnixCourse/fileAsst/TweedleDum You should be able to add and remove files from the directory, access files within the directory whose names you already know, and look through the directory via ls. Everyone else should be able to access files in the directory for which they already know the names, but have no other privileges. ~/UnixCourse/fileAsst/TweedleDee/hatter.txt :Everyone should be able to read and write to this file. ~/UnixCourse/fileAsst/TweedleDum/dormouse.txt We will pretend, for the sake of this assignment, that this file contains an executable program. You should be able to read and write to this file. You and members of your group should be able to execute it. People other than you have no other privileges.

Explanation / Answer

First of all we should understand what is permissions of UNIX file system and directories and how to set.

There are three type of permission in unix

Here actions means : Read, Write and Execute. There are two type of access mode in UNIX.

File Access Mode

Directory Access Mode

There are two way to change the permission.

1. Symbolic Mode

2. Absolute Permissions : In ths mode number are used with chmod to set the permission

0 -> No Permission (---)

1 -> Execute Permission (--x)

2 -> Write Permission (-w-)

3 -> Execute and write permission (How ? By adding 1 and 2, 1 + 2 = 3) (-wx)

4 -> Read Permission (r--)

5 -> Read and Execute permission (How ? By adding 1 and 4, 1 + 4 = 5) (r-x)

6 -> Read and Write permission (How ? By adding 2 and 4, 2 + 4 = 6) (rw-)

7 -> All permissions (How ? By adding 1, 2, and 4) (rwx)

Q: How to check permission ?

Ans : Use ls -lrt

$ ls -lrt /directory/name/

drwxrwxr-- 1 root users 1024 Oct 2 00:10 dir

-rwxrwxr-- 1 root users 1024 Oct 2 00:10 file

--------------------------------------------------------------------------------------

Solution to the questions

We are supposing that the given diretory are alreday exist in the file system. We are going the set only the required permission.

1. ~/UnixCourse You should be able to add and remove files from the directory, access files within the directory whose names you already know, and look through the directory via ls to see what files are in there. No one else should be able to do any of these things.

chmod -R 600 ~/UnixCourse

Explanation :

chmod : this is the command use to change or set permissions on file and directories

-R : Recursivly set the same permission on sub-directories and files

6 : Read and write permission to owner

0 : No permission to group memebers

0 : No permissions to others too

2. ~/UnixCourse/fileAsst You should be able to add and remove files from the directory, access files within the directory whose names you already know, and look through the directory via ls to see what files are in there. People in your group should be able to do ls and to access files, but not add/remove files from the directory. People outside your group should be able to do none of these things.

chmod -R 640 ~/UnixCourse/fileAsst

Explanation :

-R : Recursivly set the same permission on sub-directories and files

6 : Read and write permission to owner

4 : Group memebers can access the content only

0 : No permissions to others too

3. ~/UnixCourse/fileAsst/TweedleDee You should be able to add and remove files from the directory, access files within the directory whose names you already know, and look through the directory via ls. Everyone else should be able to use ls but have no other privileges.

chmod 644 ~/UnixCourse/fileAsst/TweedleDee

Explanation :

6 : Read and write permission to owner

4 : Read permission to group memebers

4 : Read permission to others

4. ~/UnixCourse/fileAsst/TweedleDum You should be able to add and remove files from the directory, access files within the directory whose names you already know, and look through the directory via ls. Everyone else should be able to access files in the directory for which they already know the names, but have no other privileges.

chmod -R 644 ~/UnixCourse/fileAsst/TweedleDum

Explanation :

-R : Recursivly set the same permission on sub-directories and files

6 : Read and write permission to owner

4 : Read permission to group memebers

4 : Read permission to others

5. ~/UnixCourse/fileAsst/TweedleDee/hatter.txt :Everyone should be able to read and write to this file.

chmod 666 ~/UnixCourse/fileAsst/TweedleDee/hatter.txt

6. ~/UnixCourse/fileAsst/TweedleDum/dormouse.txt We will pretend, for the sake of this assignment, that this file contains an executable program. You should be able to read and write to this file. You and members of your group should be able to execute it. People other than you have no other privileges.

chmod 710 ~/UnixCourse/fileAsst/TweedleDum/dormouse.txt

Explanation :

7 : All permissions to owner

1 : Execute permission to group memebers

0 : no permission to others

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote