我刚刚意识到,每个目录的默认权限/home
都设置为rwxr-xr-x
,因此任何非特权帐户都可以读取其他人的文件内容。为什么会这样?更改它是否安全?
答案1
这是因为您没有将umask
值设置为系统默认值以外的值022
。阅读man umask
以了解这些位的含义以及命令man bash
的含义umask
。
The umask is used by open(2), mkdir(2), and other system calls that create files to modify the permissions placed on newly created files or directories.
Specifically, permissions in the umask are turned off from the mode argument to open(2) and mkdir(2).