-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloud-init-config.yaml
More file actions
26 lines (24 loc) · 940 Bytes
/
Copy pathcloud-init-config.yaml
File metadata and controls
26 lines (24 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#cloud-config
packages:
- openssh-server
- openssh-client
# Set root password
chpasswd:
list: |
root:root
expire: False
runcmd:
# Set hostname (overrides rootfs default)
- hostnamectl set-hostname CLOUDHOST 2>/dev/null || echo CLOUDHOST > /etc/hostname
- sed -i 's/^127.0.0.1.*/127.0.0.1 localhost CLOUDHOST/' /etc/hosts 2>/dev/null || true
# Bring up eth0 (configured via kernel args)
- ip link set eth0 up
- sleep 1
- ip addr
# Configure SSH for password login
- sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
- sed -i 's/^#PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config
- sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
- sed -i 's/^ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/' /etc/ssh/sshd_config
- systemctl restart ssh
- echo "SSH configured" > /tmp/cloud-init-done.txt