Home  >  Article  >  Fix the 'unsafe completion-related directory detected' issue in Oh My Zsh

Fix the 'unsafe completion-related directory detected' issue in Oh My Zsh

WBOY
WBOYforward
2023-04-23 22:01:061538browse

Option 1: Change the permissions of the specified directory

One option to change the permissions is to use chmod 755, which is full permissions for the owner (you) and provides to others Read and execute permissions for the relevant directory. For example:

chmod 755 /usr/local/share/zsh

##chmod 755 /usr/local/share/zsh/site-functions

You can of course use other permission options that suit you better, but 755 should solve Oh My Zsh's insecure directory problem.

(BTW, for most setups, the default permissions for these directories are 775 for rwxrwxr-x, if you want to revert to that for any reason).

Option 2: Disable Insecure Directory Checks

If you don't want to change permissions and just disable the insecure directory verification (this basically just ignores the check, it doesn't solve the underlying security issue), You can add the following to your .zshrc file:

ZSH_DISABLE_COMPFIX=true

Using nano is one way to add this to your .zshrc file or The easy way with your text editor of choice.

修复 Oh My Zsh “检测到不安全的完成相关目录”

Again, this does not resolve the permissions complaint, it just stops checking permissions for the specified directory.

For many users, it is desirable to make /usr/local/share/zsh/ accessible to all user accounts so that all user accounts on the Mac can use Oh My Zsh, but for others who would like For people who want a more restrictive environment on shared user computers, you can also change the permissions to accommodate this. The choice is yours.

The complete error message states the following, mainly telling you how to solve the problem, but not necessarily written in the most concise way to get an immediate solution. Still, it's worth reading and reviewing so you can see what options Oh My Zsh spells out and the consequences of each option for eliminating secure messages.

[oh-my-zsh] Insecure completion dependency directory detected:

drwxrwxr-x 3 user admin 96 Jun 29 2020 /usr/local/share/zsh
drwxrwxr -x 5 user admin 160 Jul 19 14:54 /usr/local/share /zsh/sitefunction

[oh-my-zsh] For security reasons, we will not load from these directories until

[oh-my-zsh] You fix their permissions and ownership and restart zsh.
[oh-my-zsh] See the list above for directories with group or other writability.

[oh-my-zsh] To fix your permissions you can do this by disabling

[oh-my-zsh] write permissions for "group" and "others" and ensuring that
The [oh-my-zsh] owner directory is root or your current user.
[oh-my-zsh] The following command may help:
[oh-my-zsh] compaudit | xargs chmod gw,ow

[oh-my-zsh] If the above Doesn't help or you want to skip validation for

[oh-my-zsh] unsafe directories, you can
set the variable ZSH_DISABLE_COMPFIX to [oh-my-zsh] "true" before oh -my- zsh from your zshrc file.

The above is the detailed content of Fix the 'unsafe completion-related directory detected' issue in Oh My Zsh. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yundongfang.com. If there is any infringement, please contact admin@php.cn delete