When I try to login as root, this warning comes up.

luvpreet@DHARI-Inspiron-3542:/$ sudo su
zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]? 

If I say yes, it simply logs in, and my shell changes from bash to zsh.

If I say no, it says that ncompinit: initialization aborted and logs in.

After login, my shell changes to zsh.

All I ever did related to zsh, was download oh-my-zsh from github.

What is happening and why ?

Using - Ubuntu 16.04 on Dell.


You can list those insecure folders by:


The root cause of "insecure" is these folders are group writable.

There's a one line solution to fix that:

compaudit | xargs chmod g-w

Please see zsh, Cygwin and Insecure Directories and zsh compinit: insecure directories for reference.

  • This one-liner fixed my problem 👍 – Yassine ElBadaoui Apr 16 '18 at 0:29
  • My insecure directory was also other-writable, so I had to use "chmod o-w" in addition. – Ezra Jan 28 at 2:40

I encountered the same problem after following https://docs.npmjs.com/getting-started/fixing-npm-permissions, and I solved it using:

% cd /usr/local/share/zsh
% sudo chmod -R 755 ./site-functions
% sudo chown -R root:root ./site-functions

I found the answer here: https://stackoverflow.com/questions/13762280/zsh-compinit-insecure-directories


When I would run compaudit, I would get the insecure directories error from the plugins directory of oh-my-zsh. So I changed the permissions in the plugins directory:

  • cd /home/${usr}/.oh-my-zsh/custom/
  • sudo chmod -R 755 ./plugins

fixed the issue for me.

Ubuntu 16.0.4 on WSL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.