Menu Close

25.6. 更改登录 shell 的默认 umask

您可以通过修改 /etc/login.defs 文件来更改 root 用户的默认 bash umask

先决条件

  • root 访问权限

流程

  1. root 用户身份,在编辑器中打开 /etc/login.defs 文件。
  2. 修改以下部分以设置新的默认 bash umask

    # Default initial "umask" value used by login(1) on non-PAM enabled systems.
    # Default "umask" value for pam_umask(8) on PAM enabled systems.
    # UMASK is also used by useradd(8) and newusers(8) to set the mode for new
    # home directories if HOME_MODE is not set.
    # 022 is the default value, but 027, or even 077, could be considered
    # for increased privacy. There is no One True Answer here: each sysadmin
    # must make up their mind.
    
    UMASK           022

    umask 的数值(022)替换为另一个数值。如需了解更多详细信息,请参阅 User file-creation mode mask

  3. 保存更改并退出编辑器。