0
有沒有更好的方法來使用不同的模塊進行以下操作?如何防止非root用戶使用nologin shell登錄到系統?
- name: prevent non-root users from login into the system using nologin shell
command: usermod -s /usr/sbin/nologin consul
有沒有更好的方法來使用不同的模塊進行以下操作?如何防止非root用戶使用nologin shell登錄到系統?
- name: prevent non-root users from login into the system using nologin shell
command: usermod -s /usr/sbin/nologin consul
是的,你可以使用內置的模塊,它是冪等(命令呼叫不是):
- name: prevent non-root users from login into the system using nologin shell
user:
name: consul
shell: /usr/sbin/nologin