Existing permission for file dept.txt is rw- --- --- . Retain the same permissions for user and other category. Add write permission to group using octal notation or symbolic notation in unix.

Interview Questions Computer Science 1 year ago

491 1 0 0 0

Posted on 18 Jan 2024, this text provides information on Computer Science related to Interview Questions. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Answers (1)

Post Answer
profilepic.png
DarrylJamJA DarrylJamJA Tuteehub forum best answer Best Answer 1 year ago

rmissions in UnixWe are given the file Unix systems divide users into three categories:Owner/User - This is the owner of the fileGroup - Users belonging to predefined user groupOther - All other usersThese three are denoted by the letters u (user/owner), g (group) and o (other) respectively.For each user type, there can be three types of permissions for any file:Read - R - User can read the fileWrite - w - User can edit the fileExecute - x - User can execute the file (if it is an executable file LIKE a program code or application)The absence of a permission is denoted by a hyphen ( - ).File permissions are mentioned in 3 letter codes. For example, a file permission of means that:Owner can read, write and execute the file.Group can read and write the file, but not execute itOther can only read the fileThe file has the permissions This means that:Owner can read and write the file, but not execute itAnyone else cannot do anything to the file, not even read itFile permissions can be edited using the chmod command.Syntax:Symbolic NotationIn Symbolic Notation, we can change permissions using three characters:The symbols for the different user types are as follows:So, for example, currently has permissions of Then, doing will assign the permission of to the Other user type for the file. The new permissions will be Now, if we do we are adding the execute permission to all the user types. The new permissions will look like Answer:We just want to ADD the Write permission to Group and retain everything else. So, the command using symbolic notation isOctal NotationIn octal notation, we assign permissions using the digits 0-7 for each user type. So, we use a three digit code to assign permission for u, g and o. The three digits are in octal.The reference table:This assigns absolute permissions and overrides previous permissions. For example, doing will assign the following permissions:7: permissions to user/owner5: permissions to group4: permissions to other   All previous permissions are overridden.Answer:The file has permissions . These CORRESPOND to the digits 600.We are RETAINING the permissions for user and other. So, 6 and third digit 0 will remain same. We want to add write permission to group. So, for group, we want the permissions, which corresponds to the digit 2.So, our final digits are 620.Hence, we use the command:Summary has the permissions We want the new permissions to be .We can use either of the two commands:Symbolic Notation: Octal Notation: I have attached two screenshots showing these commands.


Click Here For Explanation

0 views
0 shares

No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Similar Forum


Important Interview Questions Links