The Exact Error
chmod: invalid octal value '898'
Or:
chmod: invalid mode: '0892'
chmod: invalid mode: '9'
Quick summary: Octal numbers only use digits 0-7. If any digit is 8 or 9, you get an invalid octal error. The permission system uses 3-4 octal digits (0-7 each), where each digit represents one permission group's read/write/execute bits.
Why This Error Happens
The Unix permission system represents file permissions as octal (base-8) numbers. Octal digits run from 0 to 7. If you use 8 or 9 in a chmod command, the shell rejects it immediately.
Four common causes:
1. Digit 8 or 9 in the value ā chmod 893 or chmod 9.
2. Too many digits ā chmod 1234 ā misunderstanding the digit count.
3. Copy-paste from decimal context ā Copying a permission value from documentation using decimal instead of octal.
4. Confusing month numbers with permissions ā A date like "644" is coincidentally a valid permission; "898" is not.
Step-by-Step Diagnosis
Step 1 ā Check each digit
chmod 644 # Valid: 6, 4, 4 are all 0-7
chmod 755 # Valid
chmod 898 # INVALID: 8 and 9
Step 2 ā Map permissions to octal
Position: [special][user][group][other]
7 = rwx 6 = rw- 5 = r-x 4 = r--
3 = -wx 2 = -w- 1 = --x 0 = ---
Step 3 ā Use symbolic mode to verify
chmod u=rw,g=r,o=r file # Same as 644
chmod u=rwx,g=rx,o=rx dir # Same as 755
stat -c "%a %n" filename # Shows current octal permissions