为什么我的 umask 一直重置为 000?

Mil*_*les 5 umask

当我重新登录时,我的 umask 是002. 至少有一段时间。然后在某个时候,我不确定什么时候,它会恢复为000. 这非常不方便,我现在经常担心在我的主目录中丢失具有奇怪权限的文件和文件夹。

000使用几分钟后或几天后可能会恢复为。在我第一次安装 ubuntu 几周后,它发生了很多,然后它就冷却下来了,就在最近几天,这个问题又出现了。

我可以将它设置回002with$ umask 002但这仅适用于当前 shell(如预期的那样)。

更多信息:

  • ctrl-alt-f2 上的 tty 有一个 umask ,002即使我的 f7 登录在000
  • /etc/profile 说 umask 现在由 pam_umask 处理
  • /etc/login.defsUMASK 022USERGROUPS_ENAB yes

我正在使用 XMonad 和 (oh-my-)zsh 运行 Ubuntu 13.10。

如果这是有用的,这是我的 /etc/fstab

# <file system> <mount point>   <type>  <options>       <dump>  <pass>                                    
# / was on /dev/sdb8 during installation                                                                  
UUID=96f989e0-ee94-4bff-9663-3fa479a83ad4 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sdb1 during installation                                                          
UUID=7682-B8AD  /boot/efi       vfat    defaults        0       1
# swap was on /dev/sdb7 during installation                                                               
UUID=0d7d57af-9a31-481e-9da4-1032c94f57e9 none            swap    sw              0       0
Run Code Online (Sandbox Code Playgroud)

这是我的 crontab 的删节版 crontab -l

* * * * * cd /home/miles/code/Checkin/ && ./node_modules/.bin/coffee ./client.coffee -n attercop -h secret1.com -p 8888
* * * * * cd /home/miles/code/Checkin/ && ./node_modules/.bin/coffee ./client.coffee -n attercop -h secret2.com -p 8888
Run Code Online (Sandbox Code Playgroud)

client.coffee 只是一个发送http请求的脚本。

和我的根 crontabsudo crontab -l报告no crontab for root

Mil*_*les 2

对我来说,这个问题是由一个名为 Terminal 的 Sublime Text 3 插件引起的,该插件用于从 sublime 文件启动终端。当 Terminal 启动第一个也是唯一一个000gnome-terminal 窗口时,它继承了sublime的 umask 。

希望这个答案对那些没有和我遇到同样问题的人有用,我将重申一些关于如何解决这个问题的建议,这些建议是从上面的评论中获得的:

  • 查看您的 rc 文件(.bashrc.zshrc)以查看是否存在错误umask调用。
  • 如果您使用的是 bash,请尝试bash -x -l -i -c 'exit' 2>&1 | grep umask从 rc 文件中查找对 umask 的调用。
  • 如果您使用的是 zsh,请尝试zsh -x -l -i -c 'exit' 2>&1 | grep umask查找umaskrc 文件中的调用。
  • 检查挂载时是否设置了 umask 值$HOME。在看/etc/fstab
  • 检查 cron 中是否运行了任何可能更改您的 umask 的奇怪内容。 crontab -lsudo crontab -l
  • 也许尝试使用audit来查找神秘的 umask 更改的来源。 sudo auditctl -A auditctl exit,always -S umask并查看/var/log/kern.log