blob: 29e04ce0cc8f318f53422159207c1287c64677c7 [file] [log] [blame]
Filip Pytlouna20f9e22016-02-16 13:07:03 +01001# Auto login root on tty1
2sed 's|/sbin/agetty|/sbin/agetty --autologin root|g' /etc/systemd/system/getty.target.wants/getty@tty1.service > /etc/systemd/system/getty-autologin@.service
3systemctl daemon-reload
4systemctl disable getty@tty1.service
5systemctl enable getty-autologin@tty1.service
6
7# Libvirt serial console support
8cat << 'EOF' >> /etc/systemd/system/getty-serial@.service
9[Unit]
10Description=Getty on %I
11Documentation=man:agetty(8) man:systemd-getty-generator(8)
12Documentation=http://0pointer.de/blog/projects/serial-console.html
13After=systemd-user-sessions.service plymouth-quit-wait.service
14After=rc-local.service
15
16Before=getty.target
17IgnoreOnIsolate=yes
18
19ConditionPathExists=/dev/ttyS0
20
21[Service]
22ExecStart=-/sbin/agetty --autologin root -8 --noclear %I 115200 $TERM
23Type=idle
24Restart=always
25RestartSec=0
26UtmpIdentifier=%I
27TTYPath=/dev/%I
28TTYReset=yes
29TTYVHangup=yes
30TTYVTDisallocate=yes
31KillMode=process
32IgnoreSIGPIPE=no
33SendSIGHUP=yes
34
35Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=
36
37[Install]
38WantedBy=getty.target
39DefaultInstance=ttyS0
40EOF
41
42systemctl daemon-reload
43systemctl enable getty-serial@ttyS0.service
44
45# Disable password root login
46usermod -p '!' root
47
48# Disable SSH password authentication and permit root login
49sed -i 's|[#]*PasswordAuthentication yes|PasswordAuthentication no|g' /etc/ssh/sshd_config
Filip Pytlounc814c032016-02-19 15:35:18 +010050sed -i 's|[#]*PermitRootLogin .*|PermitRootLogin yes|g' /etc/ssh/sshd_config