toogley toogley - 2 years ago 98
Linux Question

system wide oh-my-zsh configuration?

i'd like to have a system wide oh-my-zsh setup, but i'm not sure what would be the "best" approach for this. It is not my intention to ask about personal preferences or the like, i'm just unsure whether the solutions below are

my local user configuration somewhere doesn't seem right, because adding an exploit to my local cfg and therefore gain root permissions would be very easy.

Installing oh-my-zsh to
would be maybe also a security hole, because i simply haven't written it by myself.

Simply writing my own personal zshrc would be the last approach i would like to try out, because its very time-consuimg.

Any recommendations? Thanks a lot :)

Answer Source

Fair Warning: this assumes a Debian style linux, but this should work on other forms as well. This also assumes you are starting from scratch.

Part 1, the install:

You will need to install zsh system wide, and not just for one user. (you may have already done this but I'll include it just to be comprehensive)

make sure you have installed zsh, simply: sudo apt-get install zsh

Follow the oh-my-zsh install guide or you can either:

use curl

sh -c "$(curl -fsSL"

use wget

sh -c "$(wget -O -)"

Part 2, Setting up zsh when new users are added:

You will need to make it so that new users default to zsh. In your /etc/adduser.conf file edit the line that says:




You should also change it for the /etc/default/useradd file, change the line:




Part 3, set your custom theme.

I have a custom theme file (here) that I wanted all users on the system to have. First, you should add the file to your .oh-my-zsh/themes folder:

cp your_custom_style.zsh-theme ~/.oh-my-zsh/themes

Next, edit your .zshrc file in your home directory, change the ZSH_THEME="default" to ZSH_THEME="your_custom_style"

Then, reload your .zshrc file with: . ~/.zshrc

Part 4, setting up new user's home directories.

We need to to place whatever files we want the new users to have in the /etc/skel directory, because this is what the system copies when it is creating new user's home directory. See this sys admin guide for details.

Copy your user's files (you may need to sudo):

cp -r .oh-my-zsh /etc/skel/
cp .zshrc /etc/skel 

Now you will be able to add new users and they will have oh-my-zsh by default with whatever custom theme you want them to have.

If you want to change all other existing user's shell to zsh, I would recommend reading this serverfault question.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download