这意味着什么?我该如何解决?
zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]?
运行compaudit将返回如下结果:
There are insecure directories:
/usr/local/share/zsh/site-functions
这意味着什么?我该如何解决?
zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]?
运行compaudit将返回如下结果:
There are insecure directories:
/usr/local/share/zsh/site-functions
当前回答
大多数答案都提供了解决方案,但没有提到为什么会出现这种警告。以下是ZSH公司的一段摘录:
For security reasons compinit also checks if the completion system would use files not owned by root or by the current user, or files in directories that are world- or group-writable or that are not owned by root or by the current user. If such files or directories are found, compinit will ask if the completion system should really be used. To avoid these tests and make all files found be used without asking, use the option -u, and to make compinit silently ignore all insecure files and directories use the option -i. This security check is skipped entirely when the -C option is given.
因此,解决方案意味着解决以下一个(或所有)问题:
将当前用户设置为所有目录/子目录/文件的所有者,原因如下: compaudit | xargs chown -R "$(whoami)" 删除组/others文件的写权限,原因如下: Compaudit | xargs chmod go-w
另一种方法是使用跳过这些检查
compinit -u
但我并不建议这样做,因为把问题藏在地毯下只能在短期内解决问题。
其他回答
删除组写权限
compaudit | xargs chmod g-w
会成功的。
参见http://www.wezm.net/technical/2008/09/zsh-cygwin-and-insecure-directories/
今天早上,我的系统中的一些包更新了,并给我留下了这个错误消息。我使用的是Ubuntu 18.04。
显然,更新中的某些内容将用户名和组更改为数字,而不是root,如下所示:
# There are insecure files: /usr/share/zsh/vendor-completions/_code
# sudo ls -alh
-rw-r--r-- 1 131 142 2.6K 2019-10-10 16:28 _code
我只是将这个文件的用户和组改回root,问题就解决了。我不需要更改任何权限,并且警告不要这样做,除非了解问题的根本原因。
Sudo chown root _code && Sudo CHGRP root _code
在将131和142切换回根目录后,来自zsh的错误消息消失了。
我最近在卡特琳娜也收到了同样的警告。 一个简单的解决方法是将其放在.zshrc的顶部
ZSH_DISABLE_COMPFIX=true
大多数答案都提供了解决方案,但没有提到为什么会出现这种警告。以下是ZSH公司的一段摘录:
For security reasons compinit also checks if the completion system would use files not owned by root or by the current user, or files in directories that are world- or group-writable or that are not owned by root or by the current user. If such files or directories are found, compinit will ask if the completion system should really be used. To avoid these tests and make all files found be used without asking, use the option -u, and to make compinit silently ignore all insecure files and directories use the option -i. This security check is skipped entirely when the -C option is given.
因此,解决方案意味着解决以下一个(或所有)问题:
将当前用户设置为所有目录/子目录/文件的所有者,原因如下: compaudit | xargs chown -R "$(whoami)" 删除组/others文件的写权限,原因如下: Compaudit | xargs chmod go-w
另一种方法是使用跳过这些检查
compinit -u
但我并不建议这样做,因为把问题藏在地毯下只能在短期内解决问题。
我在运行google-cloud-sdk安装脚本后得到了这个问题,该脚本通过.zshrc中的一个条目将命令补全添加到shell中。
按照Homebrew的说明在zsh中配置补全是有帮助的。
此外,如果你在尝试加载这些补全时收到" zsh compinit: insecure directories "警告,你可能需要运行这个:chmod -R go-w "$(brew——prefix)/share"