Documentation
¶
Overview ¶
Package fileperm restricts a file to the account that wrote it: mode 0600 on Unix, an explicit access list on Windows, where a mode only sets the read-only attribute and protects nothing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Describe ¶
func Describe() string
Describe says what the restriction achieves here, for the warning that quotes it. On Unix a mode is the whole story.
func RestrictToOwner ¶
RestrictToOwner reasserts owner-only permissions after the file is in place. The write already asked for 0600; this catches a file an earlier version, a umask or a restore left wider.
func WriteFile ¶
WriteFile replaces path with data as one step and restricts it to the current account.
The data goes to a temporary file in the same directory first and is renamed over path, so a reader in another process sees the old file or the new one, never half of either. The temporary name is unique, because two processes can save at once. The restriction comes after the rename: on Windows the access list belongs to the file at its final path, and a temporary file's list does not survive the move.
Types ¶
This section is empty.