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

cof*_*der 8 users adduser

我想在创建新用户时在每个新用户的主目录中自动创建一个名为“.virtualenvs”的目录。

我正在使用 useradd 命令来创建新用户。

Lek*_*eyn 12

创建目录/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
Run Code Online (Sandbox Code Playgroud)