LoginSignup
4
0

More than 3 years have passed since last update.

WSLにzshを入れたときに警告が出る場合の対処法

Posted at

事象

WSL(Windows Subsystem for Linux)のUbuntuにzshを導入したのですが、起動のたびにこんなメッセージが出て困ってました。

zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]?

oh-my-zsh関連のフォルダの権限設定が適切ではないのが原因でした。
自分はWSL上のUbuntuのホームディレクトリをWindowsのホームディレクトリに変えていたので、Ubuntuからするとすべてのファイルパーミッションが777の状態になっていました。

対処法

ホームディレクトリは変更したくなかったので、対象のファイルをUbuntuのホームディレクトリにコピーし、シンボリックリンクを作成します。

/mnt/c/Users/UserName/.oh-my-zshが問題のファイルの場合の例が以下です。

$ cd
$ cp .oh-my-zsh /home/[Ubuntu側ユーザ名] -r
$ mv .oh-my-zsh .oh-my-zsh_BK //念のためバックアップ
$ ln -s  /home/[Ubuntu側ユーザ名]/.oh-my-zsh .oh-my-zsh
$ chmod 755 .oh-my-zsh -R

これで対象ファイルはUbuntu側のファイルシステム上に移動するので、パーミッションが設定でき、警告が表示されなくなりました。

4
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0