zoukankan      html  css  js  c++  java
  • sudo -s 命令 [oh-my-zsh] 报错

    运行sudo -s 命令时,[oh-my-zsh] 冒出下面一大堆提示:

    [oh-my-zsh] Insecure completion-dependent directories detected:
    drwxr-xr-x   16 duke  staff   512 Jul 14 10:14 /Users/duke/.oh-my-zsh
    drwxr-xr-x  250 duke  staff  8000 Jul 14 10:14 /Users/duke/.oh-my-zsh/plugins
    drwxr-xr-x    4 duke  staff   128 Jul 14 10:14 /Users/duke/.oh-my-zsh/plugins/git
    drwxr-xr-x    3 duke  staff    96 Jun 17 11:33 /usr/local/share/zsh
    drwxr-xr-x    6 duke  staff   192 Oct  3 10:04 /usr/local/share/zsh/site-functions
    lrwxr-xr-x    1 duke  staff    39 Jun 17 11:37 /usr/local/share/zsh/site-functions/_brew -> ../../../Homebrew/completions/zsh/_brew
    lrwxr-xr-x    1 duke  staff    44 Jun 17 11:37 /usr/local/share/zsh/site-functions/_brew_cask -> ../../../Homebrew/completions/zsh/_brew_cask
    lrwxr-xr-x    1 duke  staff    58 Oct  3 10:04 /usr/local/share/zsh/site-functions/_git -> ../../../Cellar/git/2.19.0_2/share/zsh/site-functions/_git
    
    [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.
    

      

    解决方案如下:

    问题的描述中,其实已经给了我们解决方法:

    [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.
    

      大意为:

    要修复权限,可以通过禁用“group”和“others”的写入权限并确保这些目录的所有者是root用户或当前用户来修复权限。
    以下命令可能有所帮助:
    compaudit | xargs chmod g-w,o-w
    如果上面没有帮助,或者你想跳过不安全目录的验证,你可以在你的zshrc文件中找到oh-my-zsh之前将变量ZSH_DISABLE_COMPFIX设置为“true”。

    第一种:修改相关文件夹权限

    为以上提示的文件夹修改权限(根据具体提示修改)
    chmod 755 /Users/duke/.oh-my-zsh
    chmod 755 /Users/duke/.oh-my-zsh/plugins
    chmod 755 /Users/duke/.oh-my-zsh/plugins/git
    chmod 755 /usr/local/share/zsh/site-functions
    chmod 755 /usr/local/share/zsh/site-functions/_brew
    chmod 755 /usr/local/share/zsh/site-functions/_brew_cask
    chmod 755 /usr/local/share/zsh/site-functions/_git

    第二种:设置变量 ZSH_DISABLE_COMPFIX=true

    1. 在.zshrc文件的第一行添加 ZSH_DISABLE_COMPFIX=true
    2. 运行source ~/.zshrc,重新加载.zshrc文件
  • 相关阅读:
    Codeforces Round #275 (Div. 2) A. Counterexample【数论/最大公约数】
    2017年浙工大迎新赛热身赛 J Forever97与寄信 【数论/素数/Codeforces Round #382 (Div. 2) D. Taxes】
    2017年浙工大迎新赛热身赛 A 毕业设计选题 【结构体排序】
    2017年浙工大迎新赛热身赛 L cayun日常之赏月【易错特判】
    Codeforces Round #309 (Div. 2) A. Kyoya and Photobooks【*组合数学】
    【数论知识】能被2、3、4、5、6、7、8、9 等数整除的数的特征
    Codeforces Round #429 (Div. 2) A. Generous Kefa【hash/判断字符串是否有一种字符个数大于m】
    MPI Maelstrom---poj1502(最短路模板)
    Travel---hdu5441(并查集)
    Elven Postman---hdu5444(二叉树)
  • 原文地址:https://www.cnblogs.com/wuaihua/p/12755922.html
Copyright © 2011-2022 走看看