第一种:新增用户

ansible host -m user -a "name=zhang shell=/bin/bash groups=admin,root append=yes home=/home/zhang state=present"

name:新增用户名字

shell:用户的shell

groups:添加到那些属组

append:群量变更

第二种:修改用户组

ansible host -m user -a "name=zhang groups=dba append=no"

append=no需用这个选项

第三种:修改用户属性

ansible host -m user -a "name=zhang expire=142112"

expire:过期时间

第四种:删除用户

ansible host -m user -a "name=zhang state=abent remove=yes"

第五种:变更用户密码

ansible host -m user -a "name=zhang shell=/bin/bash password=123456 update_password=always"

password:设置用户密码为制定的加密后的密码

 

相关文章:

  • 2021-08-08
  • 2021-07-24
  • 2021-12-01
  • 2022-01-02
  • 2021-09-22
  • 2021-07-21
  • 2021-09-15
  • 2021-09-17
猜你喜欢
  • 2022-01-08
  • 2021-11-08
  • 2022-01-22
  • 2021-12-05
  • 2021-11-17
  • 2022-12-23
  • 2021-06-16
相关资源
相似解决方案