zsh-users/antigen

Doesn't work with multiple users.

dpacmittal opened this issue · 3 comments

I've installed antigen for my root user. I copied the zshrc from root to my non-root user, and git cloned the antigen repo again for my non-root user. Now whenever I try to su to my non-root user, it gives me

fatal: could not create leading directories of '/root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git': Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/lib: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/lib: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/lib: Permission denied
fatal: could not create leading directories of '/root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git': Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/plugins/git: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/plugins/git: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/plugins/git: Permission denied
fatal: could not create leading directories of '/root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-completions.git': Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-completions.git/src: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-completions.git/src: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-completions.git/src: Permission denied
fatal: could not create leading directories of '/root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting.git': Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting.git/: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting.git/: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting.git/: Permission denied
fatal: could not create leading directories of '/root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search.git': Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search.git/: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search.git/: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search.git/: Permission denied
fatal: could not create leading directories of '/root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git': Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/plugins/history: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/plugins/history: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/plugins/history: Permission denied
fatal: could not create leading directories of '/root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git': Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/plugins/vundle: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/plugins/vundle: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/plugins/vundle: Permission denied
fatal: could not create leading directories of '/root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git': Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/plugins/rsync: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/plugins/rsync: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/plugins/rsync: Permission denied
fatal: could not create leading directories of '/root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git': Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/plugins/tmux: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/plugins/tmux: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/plugins/tmux: Permission denied
fatal: could not create leading directories of '/root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git': Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/plugins/history-substring-search: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/plugins/history-substring-search: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/plugins/history-substring-search: Permission denied
fatal: could not create leading directories of '/root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git': Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/themes/dpoggi.zsh-theme: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/themes/dpoggi.zsh-theme: Permission denied
ls: cannot access /root/.antigen/repos/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh.git/themes/dpoggi.zsh-theme: Permission denied

This is caused because the variable $ADOTDIR is '/root/.antigen' for both the root user and the non-root user.

It's because 'su' doesn't load the profile scripts and so $ADOTDIR is not overwritten. Try 'su -' instead.

» su  
Password: 
root@host:/home/<user># echo $ADOTDIR
/home/<user>/.antigen

» su - 
Password: 
root@host:~# echo $ADOTDIR
/root/.antigen

Not sure if it's an antigen problem.

I'm actually logged in as root and doing 'su '. How do I workaround that?

su - <username>