Search code examples
zshoh-my-zsh

How do I set the default .zshrc (oh-my-zsh) for users?


I've installed oh-my-zsh and have changed theme and customized it for the root user. How can I make these mods available for all users for which I will set zsh as default shell?


Solution

  • oh-my-zsh is best installed per user. Users can fiddle with the source, adding custom plug-ins to their .oh-my-zsh/custom directory for instance. The auto-update feature also wouldn't work on a system wide install.

    To help them get started, you can provide new users with a recent clone of .oh-my-zsh and a .zshrc template. Adding these to /etc/skel for instance.

    I'd also question whether root needs oh-my-zsh or the same zsh config as a normal user. It's best to avoid spending too much time as root anyways.

    If you really want to, you can symlink your own .oh-my-zsh and .zshrc to another user home directory including root's.

    If you have to enforce a global config. There's a global zshrc (either /etc/zshrc or /etc/zsh/zshrc depending on your system) that's loaded before the user .zshrc. If you're impersonating all users on the system, you could always load your oh-my-zsh config from there.

    Finally, you'll probably want to change the login shell of oh-my-zsh user to zsh as well. Look into /etc/passwd, chsh and adduser.conf for details.