[Unit] Description=Set random password for user root DefaultDependencies=no After=local-fs.target Before=getty@tty1.service [Service] Type=oneshot ExecStart=/bin/sh -c 'echo "root:$(openssl rand -base64 48)" | chpasswd' RemainAfterExit=yes [Install] WantedBy=multi-user.target