octal
Writing numbers in base 8, using digits 0 to 7, which is the usual way to write Unix file permissions such as 600 or 755.
In more detail
Each digit covers read (4), write (2) and execute (1) for the owner, the group and everyone else, so 600 means owner read and write only. Languages mark octal with a prefix, such as 0o in Go and Python, so it is not read as decimal.
Example
os.WriteFile("probe.conf", conf, 0o600)Related terms
- file permissions — Rules on each file saying which user and group own it and who may read, write or run it.
- umask — The builtin, and the per-process setting it controls, that lists which permission bits are removed from every new file and directory.
- os.WriteFile — The Go function that writes a slice of bytes to a file in one call, creating it with the permission mode you give if it does not exist.
Taught in
- Files and the os Package — Concurrent Systems Programming with Go