Desactivar usuario root
0 parents
Showing
1 changed file
with
26 additions
and
0 deletions
unnactivate-ssh-root
0 → 100644
| 1 | --- | ||
| 2 | - name: Desactivar acceso SSH como root | ||
| 3 | hosts: all | ||
| 4 | become: yes | ||
| 5 | tasks: | ||
| 6 | |||
| 7 | - name: Asegurar que 'PermitRootLogin no' esté en sshd_config | ||
| 8 | lineinfile: | ||
| 9 | path: /etc/ssh/sshd_config | ||
| 10 | regexp: '^#?PermitRootLogin\s+.*' | ||
| 11 | line: 'PermitRootLogin no' | ||
| 12 | state: present | ||
| 13 | backrefs: yes | ||
| 14 | |||
| 15 | - name: Asegurar que 'UsePAM yes' esté en sshd_config | ||
| 16 | lineinfile: | ||
| 17 | path: /etc/ssh/sshd_config | ||
| 18 | regexp: '^#?UsePAM\s+.*' | ||
| 19 | line: 'UsePAM yes' | ||
| 20 | state: present | ||
| 21 | backrefs: yes | ||
| 22 | |||
| 23 | - name: Reiniciar el servicio sshd | ||
| 24 | service: | ||
| 25 | name: sshd | ||
| 26 | state: restarted | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or sign in to post a comment