|(require umask)||package: umask-lib|
Set the default permissions on a Unix-like operating system. This allows one to control who may read from/write to/execute a file upon creation.
Get input from the user then save it to a temporary file that will be only readable by the current user.
(with-umask #o077 (define temporary-file (make-temporary-file)) (define secret (read-line)) (printf "Secret saved to ~a.\n" temporary-file) (with-output-to-file temporary-file (thunk (displayln secret))))
Get the umask
Set the umask so subsequently files are only readable as the current user (and root).