运行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文件

sudo -s 命令 [oh-my-zsh] 提示检测到不安全目录的更多相关文章

  1. 使用sudo执行命令的时候提示找不到命令

    事出有因, 源自使用源码编译 nginx , 在 /usr/local/sbin/ 目录下创建了nginx 启动的符号链接 , 执行 sudo nginx 的时候提示找不到命令, 但是使用普通用户身份 ...

  2. 用wampserver 装的集成环境,命令行进不去提示mysql

    命令行进不去提示mysql 不是内部命令或外部命令. 解决办法,就是将mysql/bin路径加到path中去

  3. 【转】CentOS 使用yum命令安装出现错误提示”could not retrieve mirrorlist http://mirrorlist.centos.org ***”

    源自:http://www.cnblogs.com/yangbingqi/p/3328610.html 刚安装完CentOS,使用yum命令安装一些常用的软件,使用如下命令:yum grouplist ...

  4. 命令行登陆mysql提示'mysql' 不是内部或外部命令

    问题:命令行登陆mysql提示'mysql' 不是内部或外部命令.如图1所示. 图1 原因:没有将mysql的bin文件夹配置到环境变量里区,因为命令行登陆mysql需要调用bin下的mysql.ex ...

  5. windows 中的类似于sudo的命令(在cmd中以另一个用户的身份运行命令)

    linux中我们习惯用sudo命令来临时用另一个用户的身份执行命令. windows中,通常我们需要用管理员权限执行命令的时候通常是 右键->run as administrator. 用着键盘 ...

  6. CentOS 使用yum命令安装出现错误提示”could not retrieve mirrorlist http://mirrorlist.centos.org

    CentOS 使用yum命令安装出现错误提示"could not retrieve mirrorlist http://mirrorlist.centos.org这个错误, 在网上找了好多, ...

  7. 用sudo 运行命令的时候,环境变量用的是super用户的环境变量

    比如今天在~/.bashrc设置了JAVA_HOME, 而sudo运行命令的时候却显示没有设置可用的JAVA_HOME

  8. 命令行输入Jmeter提示不是内部或外部命令,处理方式:添加环境变量

    命令行输入Jmeter提示不是内部或外部命令,需要在环境变量path中添加jmeter的bin目录绝对路径 我的电脑 > 右击 >属性 > 高级系统变量 > 环境变量 > ...

  9. 【Java_基础】cmd下使用java命令运行class文件提示“错误:找不到或无法加载主类“的问题分析

    1.问题如下 当在命令行使用java命令执行字节码文件时提示“错误:找不到或无法加载主类” 2. 问题分析 这是由于在运行时类的全名应该是包名+类名,例如在包net.xsoftlab.baike下的类 ...

随机推荐

  1. 2.Django与Vue的结合

    Django与Vue的结合 在django项目中创建vue项目 首先,进去django项目的项目目录中,执行: vue-init webpack firstvue ## firstvue为前端项目的名 ...

  2. coding++:拦截器拦截requestbody数据如何防止流被读取后数据丢失

    1):现在开发的项目是基于SpringBoot的maven项目,拦截器的使用很多时候是必不可少的,当有需要需要你对body中的值进行校验,例如加密验签.防重复提交.内容校验等等. 2):当你开开心心的 ...

  3. jsp学习笔记day1

    一.jsp简介 JSP全称Java Server Pages,是一种动态网页开发技术.它使用JSP标签在HTML网页中插入Java代码.标签通常以<%开头以%>结束. JSP是一种Java ...

  4. 使用 Visual Studio 开发、测试和部署 Azure Functions(二)测试,部署

    1,引言 上一篇介绍了使用使用 Visual Studio 开发 "Azure Functions" 函数,此篇介绍 “Azure Functions” 的测试以及直接从 Vist ...

  5. 探秘 RocketMQ 消息持久化机制

    我们知道 RocketMQ 是一款高性能.高可靠的分布式消息中间件,高性能和高可靠是很难兼得的.因为要保证高可靠,那么数据就必须持久化到磁盘上,将数据持久化到磁盘,那么可能就不能保证高性能了. Roc ...

  6. 监控一哥Prometheus你可认识?

    先大致认识认识普罗米修斯 —— Prometheus. 依据官方文档https://prometheus.io/docs/introduction/overview/ 大概能够了解到 Promethe ...

  7. 虚拟机的vmnet8网卡找不到了

    不知道我设置了什么,在我于Linux中配置网络时发现怎么都不行,检查了一下发现用于NAT的网卡没有了. 我重启了电脑之后发现还是没有. 于是按照网上的办法在虚拟网络编辑器将其重置,如下图. 问题解决. ...

  8. MTK Android Camera运行流程

    Android Camera 运行流程 总体架构1.CameraService服务的注册2.Client端的应用层到JNI层Camera App-JNI3.Client到Service的连接4.HAL ...

  9. Java第二十五天,多线程之等待唤醒机制

    当线程被创建并且被启动之后,它既不是一启动就进入了执行状态,也不是一直处于执行状态,而是具有以下多种状态: 这六种状态之间的转换关系如下: 1.等待唤醒机制 注意: (1)两个线程之间必须用同步代码块 ...

  10. 萌新带你开车上p站(二)

    本文作者:萌新 前情提要:萌新带你开车上p站(一) 0x04flag  看题目描述似乎是一个和脱壳相关的逆向题目 按照给出的地址先下载过来 file看看 是个可执行文件 执行之 emm什么都看不出来, ...