Debian – Disable the configuration tool in Zsh

configurationdebianzsh

When there is no .zshrc file in a user's home directory and zsh is started, an interactive configuration utility is run instead of directly giving access to the shell prompt.

I set up zsh to be the default shell on my Debian Wheezy systems. Therefore every newly created user gets zsh as login shell if I do not change that manually. Also there is a default .zshrc in /etc/skel, so all regular users on my system have a copy of the file in their home directory. This is not the case for system users.

When I now change into a system user (for example the user for a specific network daemon) via sudo or sh I run into the configuration tool, because these users have no .zshrc in their home directories.

It doesn't feel right to place a .zshrc into each and every daemon's home directory, which also would be a pain to setup and maintain on a lot of systems. But I still wouldn't want to downgrade to a less comfortable bash for these users.

Is there a way to disable the zsh configuration tool without having to create a .zshrc file in the user's home directory? Additionally a way to setup a single file to be the system-wide default .zshrc for all users which don't have one would be nice too.

Best Answer

from: http://www.zsh.org/mla/users/2007/msg00398.html

The shell then executes code in the file
scripts/newuser in the shared library area (by default
/usr/local/share/zsh/<VERSION>/scripts/newuser).  This feature can be
turned off simply by removing this script.  The module can be removed
entirely from the configured shell by editing the line starting
"name=zsh/newuser" in the config.modules file, which is generated in the
top level distribution directory during configuration: change the line to
include "link=no auto=no".

and /etc/zsh/zshrc is sourced by every shell that has the interactive,rcs, & globalrc options set. (which most interactive zsh processes do)


or add zsh-newuser-install() { :; } in /etc/zsh/zshenv Which has the obvious side-effect of users not being able to use the function until they undefine yours.

You can refine that by adding a test of the UID.

if (( EUID < 1000 )) && (( EUID != 0 )); then # or whatever the highest daemon uid on your system
  zsh-newuser-install() { :; }
fi
Related Question