Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

chmod Explained

Convert an octal mode to rwx and back, read what each digit grants, and see what setuid, setgid and the sticky bit actually do.

Open the converter

The part most explanations skip

A special bit does not get its own column. It overwrites the execute position of its class, and the letter's case tells you whether execute was there underneath:

Octal ls -l shows Reading
4755 rwsr-xr-x setuid, and the owner does have execute
4644 rwSr--r-- setuid set, no execute under it: almost always a mistake
2755 rwxr-sr-x setgid with execute
2644 rw-r-Sr-- setgid without
1777 rwxrwxrwt sticky with execute, as on /tmp
1644 rw-r--r-T sticky without

An uppercase letter in a mode string is a signal, not a typo: something was switched on that cannot currently do anything.

Correctness

That table was produced on a real system before the code was written, by creating files with each mode and reading back ls -l. The implementation is then tested against it in both directions, plus the round-trip, before publishing.

Limits

It converts and explains a mode. It cannot see your filesystem, so it does not know whether a mode suits a given file. Ownership matters as much as the mode, and on systems using ACLs, SELinux or AppArmor the mode is only one of the layers deciding access.

Nothing is uploaded. No server, no analytics, no storage.

Licence

MIT.

About

Convert chmod octal to rwx and back, and see what setuid, setgid and sticky actually do, including why ls shows S instead of s.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages