当我创建一个新用户时,如何自动在他们的主目录中创建一个 .virtualenvs 目录?

我想在每个新用户创建时自动在其家目录下创建一个名为".virtualenvs"的目录。
我正在使用useradd命令来创建新用户。
1个回答

创建目录/etc/skel/.virtualenvs/etc/skel目录将用作新家目录的模板。
这在/etc/adduser.conf中定义:
# The SKEL variable specifies the directory containing "skeletal" user
# files; in other words, files such as a sample .profile that will be
# copied to the new user's home directory when it is created.
SKEL=/etc/skel

1如果您正在为用户提供virtualenvwrapper,您还可以将$WORKON_HOME环境变量添加到/etc/skel/.bashrc中。 - Stephen Paulger