CentOS 7なsystemd環境でautologinする

KVMでauto loginできたらと調べて上手くできたのでメモ

cp /usr/lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@ttyS0.service

diff -Nurr /usr/lib/systemd/system/getty\@.service getty\@ttyS0.service 
--- /usr/lib/systemd/system/getty@.service      2014-10-23 20:29:59.000000000 +0900
+++ getty@ttyS0.service 2014-12-01 14:39:07.338000000 +0900
@@ -25,7 +25,7 @@
 
 [Service]
 # the VT is cleared by TTYVTDisallocate
-ExecStart=-/sbin/agetty --noclear %I
+ExecStart=-/sbin/agetty --autologin root --noclear %I
 Type=idle
 Restart=always
 RestartSec=0
@@ -44,3 +44,4 @@
 
 [Install]
 WantedBy=getty.target
+;Alias=getty@ttyS0.service


これだけだとうまく動かないので追加
[https://wiki.archlinux.org/index.php/automatic_login_to_virtual_console:title]


後で調べる。