5

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.

4

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
  • Thanks. But isn't there a way without modifying such a file? I guess if upstream updates it, my Debian package manager will overwrite it. – aef Dec 8 '12 at 2:58
  • updated my answer. – llua Dec 8 '12 at 4:57
  • 1
    Could you please explain that. What does Privileged do and why will it only be called for users with IDs above 999? – aef Dec 8 '12 at 5:07
  • -lt == Less than, the option will only be set if the uid is less than 1000, most daemon user accounts are under 1000. && man zshoptions | less -p 'Shell State' – llua Dec 8 '12 at 17:08
  • setopt Privileged doesn't disable the configuration utility and I don't read that out of the manpage either. And the case that the newuser file being modified back to it's original state by the system package manager already happened once since your original post. – aef Dec 17 '12 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.