禁用Zsh中的配置工具

aef*_*aef 6 zsh debian configuration

.zshrc用户的主目录中没有文件并zsh启动时,将运行交互式配置实用程序,而不是直接提供对 shell 提示符的访问权限。

我设置zsh为我的 Debian Wheezy 系统上的默认 shell。因此,zsh如果我不手动更改,每个新创建的用户都会作为登录 shell。也有一个默认.zshrc/etc/skel,所以我的系统上的所有普通用户在自己的主目录有文件的副本。对于系统用户而言,情况并非如此。

当我现在通过sudosh我遇到配置工具更改为系统用户(例如特定网络守护程序的用户)时,因为这些用户.zshrc在其主目录中没有。

将 a.zshrc放入每个守护程序的主目录感觉不正确,这在许多系统上设置和维护也会很痛苦。但我仍然不想降级到bash对这些用户来说不太舒服的程度。

有没有办法禁用zsh配置工具而不必.zshrc在用户的主目录中创建文件?此外,将单个文件设置.zshrc为所有没有文件的用户的系统范围默认值的方法也很好。

llu*_*lua 4

来自: 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".
Run Code Online (Sandbox Code Playgroud)

并且由每个设置了、、 &选项/etc/zsh/zshrc的 shell 获取。(大多数交互式 zsh 进程都会这样做)interactivercsglobalrc


或添加zsh-newuser-install() { :; }其中/etc/zsh/zshenv 具有明显的副作用,即用户在取消定义您的功能之前无法使用该功能。

您可以通过添加 UID 测试来优化它。

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