Filip Pytloun | ac2be79 | 2016-01-08 12:09:49 +0100 | [diff] [blame] | 1 | # Auto login root on tty1 |
| 2 | sed 's|/sbin/agetty|/sbin/agetty --autologin root|g' /etc/systemd/system/getty.target.wants/getty@tty1.service > /etc/systemd/system/getty-autologin@.service |
| 3 | systemctl daemon-reload |
| 4 | systemctl disable getty@tty1.service |
| 5 | systemctl enable getty-autologin@tty1.service |
| 6 | |
| 7 | # Libvirt serial console support |
| 8 | cat << 'EOF' >> /etc/systemd/system/getty-serial@.service |
| 9 | [Unit] |
| 10 | Description=Getty on %I |
| 11 | Documentation=man:agetty(8) man:systemd-getty-generator(8) |
| 12 | Documentation=http://0pointer.de/blog/projects/serial-console.html |
| 13 | After=systemd-user-sessions.service plymouth-quit-wait.service |
| 14 | After=rc-local.service |
| 15 | |
| 16 | Before=getty.target |
| 17 | IgnoreOnIsolate=yes |
| 18 | |
| 19 | ConditionPathExists=/dev/ttyS0 |
| 20 | |
| 21 | [Service] |
| 22 | ExecStart=-/sbin/agetty --autologin root -8 --noclear %I 115200 $TERM |
| 23 | Type=idle |
| 24 | Restart=always |
| 25 | RestartSec=0 |
| 26 | UtmpIdentifier=%I |
| 27 | TTYPath=/dev/%I |
| 28 | TTYReset=yes |
| 29 | TTYVHangup=yes |
| 30 | TTYVTDisallocate=yes |
| 31 | KillMode=process |
| 32 | IgnoreSIGPIPE=no |
| 33 | SendSIGHUP=yes |
| 34 | |
| 35 | Environment=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] |
| 38 | WantedBy=getty.target |
| 39 | DefaultInstance=ttyS0 |
| 40 | EOF |
| 41 | |
| 42 | systemctl daemon-reload |
Filip Pytloun | a5aff95 | 2016-01-08 13:11:51 +0100 | [diff] [blame] | 43 | systemctl enable getty-serial@ttyS0.service |
Filip Pytloun | ac2be79 | 2016-01-08 12:09:49 +0100 | [diff] [blame] | 44 | |
| 45 | # Disable password root login |
| 46 | usermod -p '!' root |
| 47 | |
| 48 | # Disable SSH password authentication and permit root login |
| 49 | sed -i 's|[#]*PasswordAuthentication yes|PasswordAuthentication no|g' /etc/ssh/sshd_config |
| 50 | sed -i 's|[#]*PermitRootLogin no|PermitRootLogin yes|g' /etc/ssh/sshd_config |