【BUG】oh-my-zsh|报错说compaudit | xargs chmod g-w,o-w 或 ZSH_DISABLE_COMPFIX to

shandianchengzi
新星创作者: 编程框架技术领域
领域专家: 操作系统技术领域
2025-03-05 16:51:47
报错:
[oh-my-zsh] Insecure completion-dependent directories detected:
drwxrwxr-x 13 shandian shandian 4096  2月 17 10:17 /home/shandian/.oh-my-zsh
drwxrwxr-x  4 shandian shandian 4096  4月  5  2024 /home/shandian/.oh-my-zsh/custom

[oh-my-zsh] For safety, we will not load completions from these directories until
[oh-my-zsh] you fix their permissions and ownership and restart zsh.
[oh-my-zsh] See the above list for directories with group or other writability.

[oh-my-zsh] To fix your permissions you can do so by disabling
[oh-my-zsh] the write permission of "group" and "others" and making sure that the
[oh-my-zsh] owner of these directories is either root or your current user.
[oh-my-zsh] The following command may help:
[oh-my-zsh]     compaudit | xargs chmod g-w,o-w

[oh-my-zsh] If the above didn't help or you want to skip the verification of
[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.

解决:

chmod g-w,o-w /home/shandian/.oh-my-zsh
chmod g-w,o-w /home/shandian/.oh-my-zsh/custom

其他解决方案:

 

这个警告信息来自 Oh My Zsh,它检测到了一些目录的权限不安全,可能导致潜在的安全风险。具体来说,这些目录的权限允许 其他用户 写入,这可能会被恶意用户利用来修改或注入恶意代码。

问题分析

从警告信息中可以看到,以下目录的权限不安全:

  • /home/shandian/.oh-my-zsh
  • /home/shandian/.oh-my-zsh/custom

这些目录的权限是 drwxrwxr-x,表示:

  • 所有者(shandian)有读、写、执行权限。
  • 组(shandian)有读、写、执行权限。
  • 其他用户有读、执行权限。

Oh My Zsh 认为,其他用户 的写权限是不安全的,因此拒绝加载这些目录中的补全功能。

解决方法

你可以通过以下方式解决这个问题:

方法 1:修复目录权限

运行以下命令,移除 其他用户 的写权限:


 

Zsh

compaudit | xargs chmod g-w,o-w

这将确保只有所有者可以写入这些目录。

方法 2:手动修改权限

如果你知道具体哪些目录需要修复,可以手动修改权限。例如:


 

Zsh

chmod g-w,o-w /home/shandian/.oh-my-zsh chmod g-w,o-w /home/shandian/.oh-my-zsh/custom

方法 3:跳过权限检查(不推荐)

如果你确定这些目录是安全的,可以跳过权限检查。在 ~/.zshrc 文件中添加以下行:


 

Zsh

ZSH_DISABLE_COMPFIX="true"

然后重启 Zsh:


 

Zsh

source ~/.zshrc

注意:这种方法会禁用安全检查,可能存在安全风险,建议仅在确定环境安全的情况下使用。

总结

为了确保安全,建议使用 方法 1方法 2 修复目录权限。这样可以避免潜在的安全隐患,同时让 Oh My Zsh 正常加载补全功能。

 

...全文
212 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
全志R16平台编译linux系统V1.0.txt 2017/4/11 13:36 (编译请使用编译android的lichee的选项编译生成的.config文件,不然直接编译会报错!!!!) rootroot@cm-System-Product-Name:/home/wwt/linux_r16$ tar zxvf lichee_parrotv1.1_20161202.tar.gz rootroot@cm-System-Product-Name:/home/wwt/linux_r16$ cd lichee/ rootroot@cm-System-Product-Name:/home/wwt/linux_r16/lichee$ ./build.sh config Welcome to mkscript setup progress All available chips: 0. sun8iw5p1 Choice: 0 All available platforms: 0. android 1. dragonboard 2. linux 3. tina Choice: 2 All available kernel: 0. linux-3.4 Choice: 0 All available boards: 0. bell-one 1. evb 2. evb-20 3. evb-30 4. evb-rtl8723bs 5. sc3813r Choice: 3 rootroot@cm-System-Product-Name:/home/wwt/linux_r16/lichee$ ./build.sh 错误1: KCONFIG_AUTOCONFIG=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/auto.conf KCONFIG_AUTOHEADER=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/autoconf.h KCONFIG_TRISTATE=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/tristate.config BUILDROOT_CONFIG=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/.config /home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/conf --silentoldconfig Config.in # # make dependencies written to .auto.deps # ATTENTION buildroot devels! # See top of this file before playing with this auto-preprequisites! # make[1]:正在离开目录 `/home/wwt/linux_r16/lichee/buildroot' You must install 'makeinfo' on your build machine makeinfo is usually part of the texinfo package in your distribution make: *** [dependencies] 错误 1 make:离开目录“/home/wwt/linux_r16/lichee/buildroot” ERROR: build buildroot Failed rootroot@cm-System-Product-Name:/home/wwt/linux_r16/lichee$ d/buildroot-config/conf.o /home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/zconf.tab.o -o /home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buil

4

社区成员

发帖
与我相关
我的任务
社区描述
在这里,记录我认为写得有最帮助的推文~~~ 同类型的推文只选我看过的最棒的!欢迎大家用自己更棒的推文替换它!
物联网系统安全python 个人社区 湖北省·武汉市
社区管理员
  • shandianchengzi
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧