You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
406 B
Bash

#!/bin/sh
ppwd="$(sed -ne '/^root:/s/^root:\([^:]*\):.*$/\1/p' /etc/passwd)"
spwd="$(sed -ne '/^root:/s/^root:\([^:]*\):.*$/\1/p' /etc/shadow)"
if [ -n "${ppwd#[\!x]}" ] && [ -z "${spwd#[\!x]}" ]; then
logger -t migrate-shadow "Moving root password hash into shadow database"
sed -i -e "s:^root\:[^\:]*\::root\:x\::" /etc/passwd
sed -i -e "s:^root\:[^\:]*\::root\:$ppwd\::" /etc/shadow
fi
exit 0