创建新用户时,如何在其主目录中自动创建.virtualenvs目录?


8

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

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

Answers:


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

1
如果你给你的用户virtualenvwrapper您可以添加$WORKON_HOME环境变量/etc/skel/.bashrc,以及
斯蒂芬Paulger
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.