Reading a permission string like rwxr-x---

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Reading a permission string like rwxr-x---

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. In the permission string rwxr-x---, who do the FIRST three characters (rwx) apply to?
A The owner
B Everyone else (others)
2. What does the group part (r-x) of rwxr-x--- allow?
A Read and execute, but not write
B Read and write, but not execute
3. In rwxr-x---, what can others (the last three characters) do?
A Read the file only
B Nothing, because all three are dashes
4. Which permission string means the owner can read and write, but the group and others can only read?
A rw-r--r--
B r--rw-r--
5. What does a dash (-) mean in a permission string like rw-r--r--?
A That permission is allowed but unused
B That permission is not allowed

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1rwxr-x--- AOwner can read, write and execute; group can read and execute; others have no access.
2rw-r--r-- B644 = rw-r--r--
3Numeric form 755 gives the owner full permissions and everyone else read and execute only. C755 = rwxr-xr-x
4Numeric form 644 gives the owner read and write, and everyone else read only. DOwner can read and write; group and others can only read.
5rwxr-x--- means others can read and execute EOthers are the LAST group, which is ---, so they have no access. The r-x belongs to the group, not others.
6rw-r--r-- means the owner can only read FThe first group rw- shows the owner can read and write. The dash in the third place only means no execute.

Definitions

rwxr-x---

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
Permission: rwxr-x--- Owner: rwx Group: ___ Others: ---
2.
r = read, w = write, _ = execute
3.
rwxr-xr-x is the same as ___
4.
rw-r--r-- is the same as ___
5.
Others have no access: rwxr-x___

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A perm = "rwxr-x--"
B owner = perm[0:3]
C group = perm[3:6]
D others = perm[6:9]
Question 2
A perm = "rw-r--r--"
B owner = perm[0:2]
C group = perm[3:6]
D others = perm[6:9]
Question 3
A perm = "rwxr-xr-x"
B group = perm[6:9]
C print(group)
Question 4
A r = 4
B w = 2
C x = 2
D print(r + w + x)
Question 5
A perm = "rw-r--r--"
B owner = 4 + 2
C group = 4
D others = 0
E print(owner, group, others)

Answer Key

Reading a permission string like rwxr-x---
Section A: Quick Questions
Q1
A — The owner
Q2
A — Read and execute, but not write
Q3
B — Nothing, because all three are dashes
Q4
A — rw-r--r--
Q5
B — That permission is not allowed
Section B: Match the Pairs
Q1
rwxr-x--- → Owner can read, write and execute; group can read and execute; others have no access.
Q2
rw-r--r-- → Owner can read and write; group and others can only read.
Q3
Numeric form 755 gives the owner full permissions and everyone else read and execute only. → 755 = rwxr-xr-x
Q4
Numeric form 644 gives the owner read and write, and everyone else read only. → 644 = rw-r--r--
Q5
rwxr-x--- means others can read and execute → Others are the LAST group, which is ---, so they have no access. The r-x belongs to the group, not others.
Q6
rw-r--r-- means the owner can only read → The first group rw- shows the owner can read and write. The dash in the third place only means no execute.
Section C: Definitions
Q1
rwxr-x--- — Three groups of three letters for owner, group and others: r is read, w is write, x is execute and - means not allowed. Here the owner has rwx, group r-x, others nothing.
Section D: Fill in the Blanks
Q1
Permission: rwxr-x--- Owner: rwx Group: r-x Others: ---
Q2
r = read, w = write, x = execute
Q3
rwxr-xr-x is the same as 755
Q4
rw-r--r-- is the same as 644
Q5
Others have no access: rwxr-x---
Section E: Spot the Error
Q1
A — A permission string must have 9 characters (3 groups of 3). This one has only 8, so the others group is incomplete. It should be "rwxr-x---".
Q2
B — The owner group is the first three letters, so the slice must be perm[0:3]. Slicing 0:2 misses the x/dash for execute.
Q3
B — The group permissions are the middle three letters, perm[3:6]. perm[6:9] is the others group.
Q4
C — In numeric form read is 4, write is 2 and execute is 1. Giving execute the value 2 would make 755 and 644 add up wrongly. It should be x = 1.
Q5
D — The others group in rw-r--r-- is r--, which allows read only, so its number is 4. This is why the numeric form is 644. It should be others = 4.