【问题标题】:programmatically clone /etc/skel for new users以编程方式为新用户克隆 /etc/skel
【发布时间】:2018-05-19 15:51:00
【问题描述】:

/etc/skel 是一个将为新用户克隆的文件夹。有没有一种可能的方法可以定义规则从/etc/skel 文件夹中复制什么?

例如,我正在寻找一种方法,如果创建了一个用户并且属于名为A 的组,则克隆/etc/skel 文件夹,但/etc/skel/not_for_a.txt 除外。可能吗?

【问题讨论】:

  • man page -- 不是编程问题;投票结束。
  • 您可以编写一个脚本,该脚本 (a) 创建用户,然后 (b) 执行任何必要的附加逻辑。

标签: linux ubuntu centos redhat pam


【解决方案1】:

If the file /usr/local/sbin/adduser.local exists, it will be exe‐ cuted after the user account has been set up in order to do any local setup. The arguments passed to adduser.local are: username uid gid home-directory

创建用户后可以使用/usr/local/sbin/adduser.local调用命令

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-03-13
    • 2020-05-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-31
    • 1970-01-01
    相关资源
    最近更新 更多