当 umask 为 0022 时,Mkdir 创建具有 777 权限的目录

当 umask 为 0022 时,Mkdir 创建具有 777 权限的目录

我在容器内创建目录,用户是 root,输出是umask0022但是如果我调用mkdir创建新目录,它的默认权限是777,而不是755。同时,如果我从 github 提取代码,我发现所有目录都有777权限。

创建目录时,我必须指定权限,如:mkdir -m 755 my_folder,如果我想要默认权限是755

为什么会发生这种情况?如何将新目录的默认权限设为755

另一个有趣的观察:
1)这仅发生在从 ZFS 服务器挂载的分区中
2)对于本地分区,mkdir按预期运行并使用 创建所有目录755

输出mount | grep nfs

storage-server:/mypool/work/nautilusshell on /work type nfs4 (rw,relatime,vers=4.2,rsize=8192,wsize=1048576,namlen=255,hard,proto=tcp,timeo=14,retrans=2,sec=sys,clientaddr=10.200.0.2,local_lock=none,addr=10.200.0.4)
storage-server:/mypool/storage on /data type nfs4 (rw,relatime,vers=4.2,rsize=8192,wsize=1048576,namlen=255,hard,proto=tcp,timeo=14,retrans=2,sec=sys,clientaddr=10.200.0.2,local_lock=none,addr=10.200.0.4)
storage-server:/mypool/work/nautilusshell on /job type nfs4 (rw,relatime,vers=4.2,rsize=8192,wsize=1048576,namlen=255,hard,proto=tcp,timeo=14,retrans=2,sec=sys,clientaddr=10.200.0.2,local_lock=none,addr=10.200.0.4)
storage-server:/mypool/work/nautilusshell/master on /pod type nfs4 (rw,relatime,vers=4.2,rsize=8192,wsize=1048576,namlen=255,hard,proto=tcp,timeo=14,retrans=2,sec=sys,clientaddr=10.200.0.2,local_lock=none,addr=10.200.0.4)
storage-server:/mypool/work/nautilusshell on /home/nautilusshell type nfs4 (rw,relatime,vers=4.2,rsize=8192,wsize=1048576,namlen=255,hard,proto=tcp,timeo=14,retrans=2,sec=sys,clientaddr=10.200.0.2,local_lock=none,addr=10.200.0.4)
storage-server:/mypool/work/nautilusshell/.ssh/id_rsa on /home/nautilusshell/.ssh/id_rsa type nfs4 (ro,relatime,vers=4.2,rsize=8192,wsize=1048576,namlen=255,hard,proto=tcp,timeo=14,retrans=2,sec=sys,clientaddr=10.200.0.2,local_lock=none,addr=10.200.0.4)
storage-server:/mypool/work/nautilusshell/.ssh/id_rsa.pub on /home/nautilusshell/.ssh/id_rsa.pub type nfs4 (ro,relatime,vers=4.2,rsize=8192,wsize=1048576,namlen=255,hard,proto=tcp,timeo=14,retrans=2,sec=sys,clientaddr=10.200.0.2,local_lock=none,addr=10.200.0.4)
storage-server:/mypool/work/nautilusshell/.ssh/authorized_keys on /home/nautilusshell/.ssh/authorized_keys type nfs4 (ro,relatime,vers=4.2,rsize=8192,wsize=1048576,namlen=255,hard,proto=tcp,timeo=14,retrans=2,sec=sys,clientaddr=10.200.0.2,local_lock=none,addr=10.200.0.4)

相关内容