CertNote/ Commute Study Notes
Roadmap
KOEN
CLF-C02 · FoundationalCloud Practitioner - Foundational
DVA-C02 · AssociateDeveloper - Associate
SAA-C03 · AssociateSolutions Architect - Associate
SOA-C02 · AssociateCloudOps Engineer - Associate
SAP-C02 · ProfessionalSolutions Architect - Professional
DOP-C02 · ProfessionalDevOps Engineer - Professional
Linux Master 2 · 2급KAIT Linux Master - Level 2
  • Week 1
    • 1.Operating Systems and the Kernel: What Linux Does
    • 2.The Birth of Linux: From Unix to Linus
    • 3.Free Software and Open Source: What a License Decides
    • 4.Distributions: The Unit That Bundles the Kernel and Tools for Sale
    • 5.Week 1 Review: The Identity Behind the Name Linux
  • Week 2
  • Week 3
  • Week 4
    • 1.The Structure of Permissions: rwx and Octal
    • 2.Ownership and umask
    • 3.Special Permissions: SetUID · SetGID · Sticky bit
    • 4.Directory Hierarchy and File System Management
    • 5.Week 4 Review: Permissions on One Page
  • Week 5
  • Week 6
  • Week 7
  • Week 8
  • Week 9
  • Week 10
  • Week 11
SCS-C03 · SpecialtySecurity - Specialty
Linux Master 1 · 1급KAIT Linux Master - Level 1
MLA-C01 · AssociateMachine Learning Engineer - Associate
AIF-C01 · FoundationalAI Practitioner - Foundational
DEA-C01 · AssociateData Engineer - Associate
MLS-C01 · SpecialtyMachine Learning - Specialty
SQLD · 개발자SQL Developer (SQLD)

© CertNote · 주간랩스

  • About
  • Changelog
  • Contact
  • Terms
  • Privacy
← Linux Master 2/Week 4/Day 5

Based on the Linux Master 2 exam syllabus·Report an error

Linux Master 2· AssociateWeek 4 · Day 5~19 min read

Day 5 - Week 4 Review: Permissions on One Page

📌 Key Takeaways

  • Permissions are four digits: [special][owner][group][other]. If the first digit is 0, it is omitted.
  • r=4 w=2 x=1, SetUID=4 SetGID=2 Sticky=1 — both lines use the same 4·2·1.
  • umask is subtraction. It is subtracted from 666 for files and 777 for directories. The default 022 → 644 / 755.
  • chown is root only, while chmod can also be done by the owner.
  • df is the file system, du is the path. umount has no n.

Permissions on One Page

   chmod  4  7  5  5   file
          │  │  │  │
          │  │  │  └── other   r-x
          │  │  └───── group   r-x
          │  └──────── user    rwx
          └─────────── special SetUID
                       4 SetUID · 2 SetGID · 1 Sticky
 
   -rws r-x r-x
    │└┬┘ └┬┘ └┬┘
    │ │   │   └── other
    │ │   └────── group
    │ └────────── owner (the s in the x slot = SetUID)
    └──────────── file type
   umask calculation
 
     file        666  -  umask
     directory   777  -  umask
 
     022  →  file 644 · directory 755   (default)
     077  →  file 600 · directory 700   (strict)
     000  →  file 666 · directory 777   (a file is not 777!)

Octal Conversion Table — Memorize This

DigitNotationDigitNotation
7rwx3-wx
6rw-2-w-
5r-x1--x
4r--0---
Permission valueNotationWhere it's used
644rw-r--r--Regular files
755rwxr-xr-xDirectories and executables
600rw-------Private keys
1777rwxrwxrwt/tmp
4755rwsr-xr-x/usr/bin/passwd

Contrasting Easily Confused Pairs

ComparisonABDeciding criterion
x on a file vs x on a directoryExecuteEnter (cd)What the target is
r on a file vs r on a directoryRead contentsView listingSame as above
chmod 755 vs chmod u+xOverwrites everythingAdds to the current statePreserving existing permissions
chown vs chgrpOwnerGroupWhat gets changed
chown vs chmodRoot onlyOwner can tooWho can do it
SetUID vs SetGIDOwner's privilegesGroup's privileges / group inheritanceWhich slot the s is in
SetGID (file) vs SetGID (directory)Run with group privilegesPass the group downWhat the target is
Sticky vs plain wDelete only your ownDelete others' tooWhether deletion is restricted
s vs Sx permission presentNo x permissionCase
df vs duFile system capacityUsage per pathWhat it counts
/bin vs /sbinRegular commandsAdministrator commandsWho uses them
/ vs /rootTop levelroot's homeLocation
/mnt vs /mediaManual mountsRemovable mediaWhether automatic

Commonly Missed Points

  1. With umask 000, a file is 777 → No. The file base value is 666, so it is 666. It is the directory that becomes 777.
  2. umask is addition → It is subtraction. The larger the value, the narrower the permissions.
  3. x on a directory is execute → It is enter. Without x, cd doesn't work.
  4. A read-only file can't be deleted → It can be deleted. Deletion is decided by the directory's w, not the file. What prevents this is the Sticky bit.
  5. If you're the owner, you can do everything → No. Only the single user slot applies. If the owner slot is narrow, the owner can't read.
  6. You can hand your own file to someone else → chown is possible for root only.
  7. unmount → It is umount. No n.
  8. Running fsck while mounted → There's a risk of damage. Always do it after unmounting.
  9. Special permission order as 1·2·4 → It is 4 (SetUID) · 2 (SetGID) · 1 (Sticky). Memorize it in the same order as rwx.
  10. With umask 033, a file is 633 → It is 644. umask just switches off the permissions that are on, so there is nothing to subtract for the x that the file never had.
  11. SetUID runs with root privileges → Precisely, it is the privileges of the file's owner. When the owner is root, it becomes root privileges.
  12. With the Sticky bit set, you can't read others' files → What it blocks is only deletion and renaming. Read and write are decided by the file's own permissions.
  13. df /var/log is the size of that directory → It is the capacity of the entire file system that directory belongs to. The directory size is du -sh.
  14. chmod -r for subdirectories → Recursion is uppercase -R. The same for chown and chgrp.

Calculations to Work Out by Hand

In the exam room, you have to convert on the spot with no calculator. Let's follow one of each type.

Type ① Symbols ↔ Numbers

   rwxr-x--x   →  (4+2+1)(4+0+1)(0+0+1)  →  751
   rw-rw----   →  (4+2+0)(4+2+0)(0+0+0)  →  660
   640         →  6=rw-  4=r--  0=---    →  rw-r-----
   711         →  7=rwx  1=--x  1=--x    →  rwx--x--x
  • Quick check: odd digits have x. 6, 4, 2, and 0 can't execute; 7, 5, 3, and 1 can.

Type ② Results of the Symbolic Method

Start from rw-r--r-- (644) and apply them in order.

CommandResultValue
chmod u+xrwxr--r--744
chmod go-rrwx------700
chmod a+rrwxr--r--744
chmod g=rwrwxrw-r--764
chmod o=rwxrw----760
  • + and - change only what's written, and = replaces all three slots of that target. g=rw erases the permissions the group had and rewrites it as rw-.

Type ③ umask

umaskDirectory (from 777)File (from 666)
022755644
002775664
027750640
077700600
033744644
000777666
  • If you fix an order, you won't go wrong — find the directory value first (777 − umask), and removing the x from it gives the file value.
  • There are questions that ask in reverse, too. "A new directory is created as 750. What is the umask?" → 777 − 750 = 027.

Type ④ Reading Special Permissions

NotationValueWhat is set
-rwsr-xr-x4755SetUID
-rwxr-sr-x2755SetGID
drwxrwxrwt1777Sticky bit
drwxrws---2770SetGID (collaboration directory)
-rwsr-sr-x6755SetUID + SetGID
-rwSr--r--4644SetUID but no execute permission
  • An s in the first three slots is SetUID, an s in the middle three slots is SetGID, and a t at the very end is Sticky.

What Can This Person Do

The key to permission questions is sorting out "who gets which slot." alice and bob are in the dev group, and carol is not.

   drwxrwx--T  2 root  dev   /project
   -rw-r-----  1 alice dev   /project/plan.txt
QuestionAnswerReason
Can bob read plan.txtOdev group → the file's group slot r--
Can bob modify plan.txtXThe group slot has no w
Can bob delete plan.txtXThe directory has w, but the Sticky bit is set so only the owner can delete
Can bob create a new file in /projectOThe directory's group slot rwx
Can carol enter /projectXThe directory's other slot has no x (the T is uppercase)
Can alice change plan.txt's owner to bobXchown is root only
Can alice change plan.txt's permissionsOchmod can be done by the owner too
  • The order of reasoning is always the same — ① which slot applies (owner → group → other, just one) ② is the target a file or a directory ③ if it's deletion, it is the directory's permissions and the Sticky bit, not the file's.

Collected Commands and Options

CommandWhat it doesOptions you must remember
chmodChange permissions-R recursive
chownChange owner (and group)-R, owner:group format
chgrpChange group-R
umaskView/set the default permission mask-S view in symbols
mountAttach a file system-t type, -o options, -a all of fstab
umountDetachDevice name or mount point
dfCapacity per file system-h, -T type, -i inode
duUsage per path-h, -s total
fsckCheck/repair a file system-y yes to all, run after unmounting
find -permFind by permissions-perm -4000 includes SetUID
statShows octal and symbolic permissions together
ls -ldPermissions of the directory itself
FileWhat
/etc/fstabThe list to mount at boot (6 fields)
/etc/mtab, /proc/mountsThe list currently mounted
/etc/profile, /etc/bashrcSystem-wide umask setting
~/.bashrcPer-user umask setting

One-Line Summaries of Directories

DirectoryOne lineDirectoryOne line
/binBasic commands/sbinAdministrator commands
/etcConfiguration files/varChanging things like logs and spool
/homeUser homes/rootroot's home
/devDevice files/procKernel and process info (virtual)
/bootKernel and bootloader/libShared libraries
/usrApplications/optAdditional packages
/tmpTemporary files (1777)/mnt, /mediaMount points

Values That Appear on the Exam Exactly

ValueWhat
4 / 2 / 1r / w / x, and also SetUID / SetGID / Sticky
022The typical default umask
666 / 777Base values for the umask calculation (file / directory)
644 / 755Result of umask 022
1777Permission of /tmp
4755Permission of /usr/bin/passwd
s / tDisplay characters for SetUID·SetGID / Sticky bit

Next week covers the program that receives and interprets commands — the shell. Environment variables, redirection, and aliases come up.

📖 Glossary

  • Special permission slot : The first digit of the four permission digits. If 0, it is omitted and written as three digits.
  • umask : The value to trim from the permissions of new files and directories. The base is 666 for files and 777 for directories.
  • SetUID / SetGID / Sticky bit : Special permissions with the values 4, 2, and 1 respectively.
  • Mount point : The directory where a file system is attached.
  • FHS : The Filesystem Hierarchy Standard that fixes directory names and roles.
  • inode exhaustion : A state where capacity remains but no more files can be created. Check with df -i.

📝 Practice Questions

Click a choice to reveal the answer and explanation.

Question 1

Which of the following is the special permission set by the command chmod 1777 /shared?

Question 2

When the umask value is 000, which of the following is the permission of a newly created regular file?

Question 3

Which of the following is the condition that allows you to delete a file even if you don't have write permission on the file itself?

Question 4

Which of the following is the directory where administrator commands are mainly stored?

Question 5

Which of the following states does the permission notation -rwxr-sr-x represent?

Question 6

Which of the following commands checks the total capacity taken up by a specific directory as a sum?

PreviousDirectory Hierarchy and File System ManagementWeek 4 · Day 4Next What Is a Shell?Week 5 · Day 1

Official references

  • Linux Master 2 official exam syllabus(opens in a new tab)

On this page

  • Key Takeaways
  • Permissions on One Page
  • Octal Conversion Table — Memorize This
  • Contrasting Easily Confused Pairs
  • Commonly Missed Points
  • Calculations to Work Out by Hand
  • Type ① Symbols ↔ Numbers
  • Type ② Results of the Symbolic Method
  • Type ③ umask
  • Type ④ Reading Special Permissions
  • What Can This Person Do
  • Collected Commands and Options
  • One-Line Summaries of Directories
  • Values That Appear on the Exam Exactly
  • Glossary
  • Practice Questions