Skip to content

Commit

Permalink
Ignore insecure directories on non-admin Zsh user
Browse files Browse the repository at this point in the history
Commit c496edb updated the Zsh completion initialization script. This
resulted in an error for non-admin users:

```
zsh compinit: insecure directories and files, run compaudit for list.
```

I have admin and non-admin user accounts on my macOS work machine. For
security purposes (supposedly), I have to do my day-to-day-work with the
non-admin account, and only use the admin account for tasks requiring
those perms, like software upgrades. This means my Zsh installation, and
all related directories, are owned by the admin account, and I can't
simply `chmod` and `chown` to the non-admin account.

The solution is to ignore insecure directories on the non-admin account.

~/.zshrc:

```zsh
autoload -Uz compinit
if [ "$(whoami)" = "brendon.smith" ]; then
  compinit -i # Ignore insecure directories
else
  compinit
fi
```

The non-admin account doesn't have permissions to perform any actions on
the pertinent directories, so ignoring them doesn't pose a security risk
that I'm aware of.

Also see zsh-users/zsh-completions#680.
  • Loading branch information
br3ndonland committed Jun 20, 2020
1 parent dfb109f commit 9482cc4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ prompt pure
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh-completions:$FPATH
autoload -Uz compinit
compinit
if [ "$(whoami)" = "brendon.smith" ]; then
compinit -i # Ignore insecure directories (perms issues for non-admin user)
else
compinit
fi
fi
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

0 comments on commit 9482cc4

Please sign in to comment.