Chmod and Umask Calculator

Work out Linux and macOS file permissions both ways, digits or letters, with the special bits, ready chmod and find commands, safety warnings and umask results.

S'executa al teu navegador. Els fitxers mai no surten del dispositiu. Mira com comprovar-ho

…

Com es fa

  1. 1
    Enter the mode

    Type digits like 644 or letters like rw-r--r--.

  2. 2
    Or tick boxes

    Use the checkboxes for each class.

  3. 3
    Add special bits

    Tick setuid, setgid or sticky if needed.

  4. 4
    Read the result

    Check the table and warnings.

  5. 5
    Check the umask

    Enter your umask to see new-file defaults.

  6. 6
    Copy the command

    Run chmod or the find commands.

Sobre aquesta eina

Unix permissions decide who can read, change and run each file. They are written either as three octal digits, such as 644, or as nine letters, such as rw-r--r--, and both forms appear in documentation, error messages and ls -l output. Converting between them in your head is error-prone, especially with the special bits: setuid, setgid and sticky. This calculator accepts either form, or tick boxes, and shows the other, explains what the owner, group and everyone else can do, writes the chmod command in both numeric and symbolic style, and gives find commands that set folders and files separately, the right way to fix a whole tree. It also shows what a umask such as 022 or 027 means for newly created files and folders, and warns about risky settings like world-writable files or setuid scripts.

Reading permissions

Each class (owner, group, others) gets three bits: read (4), write (2) and execute (1). Add them for the digit: rwx = 7, rw- = 6, r-x = 5, r-- = 4. 755 therefore means rwxr-xr-x.

Folders are different

For a folder, read lets you list its contents, write lets you create and delete files in it, and execute lets you enter it and reach files inside. That is why folders are usually 755 and files 644, and why the find commands treat them separately.

Special bits

- setuid (4000): a program runs with its owner's rights, shown as s in the owner's execute position. Used by passwd; dangerous elsewhere. - setgid (2000): on a program, runs with the group's rights; on a folder, new files inherit the folder's group, handy for shared project folders (2775). - sticky (1000): on a shared folder, only a file's owner can delete it, as in /tmp (1777). A capital S or T means the special bit is set without execute, which is usually a mistake.

Umask

The umask removes permissions from newly created items. Files start from 666 and folders from 777, so umask 022 gives 644 files and 755 folders, while 027 gives 640 and 750, keeping others out.

Common modes

The table lists the usual choices with their purpose: 600 for private files and SSH keys, 700 for ~/.ssh, 755 for programs and folders, 644 for ordinary files, 2775 for shared group folders and 1777 for temporary folders.

Limits

Access control lists (setfacl) and SELinux or AppArmor rules can grant or deny access beyond these bits. Windows file systems mounted on Linux may ignore chmod. Not a security audit; review permissions on sensitive systems carefully.

Exemple resolt

A deploy script shows -rwxr-xr-x in ls -l: the calculator gives 755, owner can read, write and execute, group and others can read and execute, and chmod u=rwx,g=rx,o=rx script.sh; with umask 027, new files would be 640.

En resum

Preguntes freqüents

What does chmod 755 mean?

Owner can read, write and execute; group and others can read and execute.

What should a private SSH key be?

600, or 400 for read-only; SSH refuses keys others can read.

What is the sticky bit?

On a shared folder, it lets only the owner of a file delete it.

Why use find for a whole folder?

Folders need execute to be entered but files usually should not be executable.

What does umask 022 do?

New files get 644 and new folders 755.

Does this change my files?

No. It only calculates; run the commands yourself.

Totalment gratisSense cost, sense registre
Els fitxers es mantenen privatsTot funciona al teu navegador
Fàcil en el teu idiomaDisponible en molts idiomes