💾 Archived View for goodclover.xyz › notes › computers › unix-perms.gmi captured on 2021-12-05 at 23:47:19. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

UNIX permissions

Permissions go in the order:

user group others

read (r) = 4 100

write (w) = 2 010

execute (x) = 1 001

To combine permissions add them up.

For directories:

read = View files and sub-directories.

write = Create files and sub-directories.

execute = Can enter the directory. (what does this mean? cd?)

chmod can be used to change the permissions of a file or directory.

Examples

Giving read and write to the owner (4+2=6), and read to the group and others (4).

chmod 644 foo.sh
rw- r-- r--

Give read and execute to the owner (4+1=5), read to the group (4) and nothing to others (0).

chmod 540 foo.sh
r-x r-- ---

Give read and write to the user (4+2=6), nothing to the group (0), and read to others (4).

chmod 604 foo.sh
rw- --- r--