Uses umask to avoid creating world-readable files.