Problem 7 (12 points): Answer the following questions about the chmod command: a
ID: 3849292 • Letter: P
Question
Problem 7 (12 points): Answer the following questions about the chmod command:
a) Compare and contrast symbolic notation and numeric notation.
b) Using symbolic notation, how would you add write and execute permission for the user?
c) Using symbolic notation, how would you take away read permission from the group and the others?
d) Using numeric notation, how would you assign the permission string -rw--w--w- ?
e) Using numeric notation, how would you assign the permission string -r--rwx--- ?
f) If you have a link to a file rather than the actual file, how do you change the permissions of the link itself rather than the actual file (hint: look up the man page for chmod)?
g) What does chmod a=rw music.rtf accomplish?
Explanation / Answer
Compare and contrast symbolic notation and numeric notation.
Numeric mode:
Numeric Mode forms one to four octal digits [0-7] which derived by adding up the bits with values 4, 2, and 1 and the omitted digits assumed leading zeros.
The first digit selects the set user ID (4) and set group ID (2) and sticky (1) attributes. The second digit selects permissions for the user who owns the file: read (4), write (2), and execute (1); the third selects permissions for other users in the file's group, with the same values; and the fourth for other users not in the file's group, with the same values.
Symbolic mode:
Symbolic Mode forms a '[ugoa...][[+-=][rwxXstugo...]...][,...]'. Combination of the letters 'ugoa' controls the users' access to the file changed, the user 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.
Operator '+' causes the permissions selected to be added to the existing permissions of each file; '-' causes them to be removed; and '=' causes them to be the only permissions that the file has.
Letters 'rwxXstugo' select the new permissions for the affected users such as read (r), write (w), execute (or access for directories) (x), execute only if the file is a directory or already has execute permission for some user (X), set user or group ID on execution (s), sticky (t), the permissions granted to the user who owns the file (u), the permissions granted to other users who are members of the file's group (g), and the permissions granted to users that are in neither of the two preceding categories (o).
Using symbolic notation, how would you add write and execute permission for the user?
In the following example, write and execute permissions are added for user, group, and others.
$ chmod a+wx fileb
Using symbolic notation, how would you take away read permission from the group and the others?
In the following example, read permission are taken away from others.
$ chmod o-r filea
Using numeric notation, how would you assign the permission string -rw--w--w- ?
0622 owner has read & write, group and users has write
Using numeric notation, how would you assign the permission string -r--rwx--- ?
0470 owner read only, group has read, write and execution permission
If you have a link to a file rather than the actual file, how do you change the permissions of the link itself rather than the actual file (hint: look up the man page for chmod)?
What does chmod a=rw music.rtf accomplish?