blob: 5cd815939a25904a70b99eed7aa3220a3a18e53f [file] [log] [blame]
Filip Pytlounac2be792016-01-08 12:09:49 +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
Filip Pytlouna5aff952016-01-08 13:11:51 +010043systemctl enable getty-serial@ttyS0.service
Filip Pytlounac2be792016-01-08 12:09:49 +010044
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
50sed -i 's|[#]*PermitRootLogin no|PermitRootLogin yes|g' /etc/ssh/sshd_config