Allow passwordless sudo for ssh login user
This commit is contained in:
+9
-2
@@ -26,6 +26,13 @@
|
||||
append: yes
|
||||
groups:
|
||||
- sudo
|
||||
- name: allow passwordless sudo for new user
|
||||
template:
|
||||
src: etc/sudoers.d/ssh_user.j2
|
||||
dest: /etc/sudoers.d/{{ ssh_user }}
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0440
|
||||
- name: add authorized key to SSH login user
|
||||
authorized_key:
|
||||
key: "{{ item }}"
|
||||
@@ -41,13 +48,13 @@
|
||||
path: /etc/ssh/sshd_config
|
||||
line: 'PermitRootLogin no'
|
||||
state: present
|
||||
insertafter: EOF
|
||||
insertafter: EOF
|
||||
- name: disable password authentication
|
||||
lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
line: 'PasswordAuthentication no'
|
||||
state: present
|
||||
insertafter: EOF
|
||||
insertafter: EOF
|
||||
- name: set modern host key
|
||||
lineinfile:
|
||||
dest: /etc/ssh/sshd_config
|
||||
|
||||
Reference in New Issue
Block a user