2012-01-22 22:25:42 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2016-09-24 12:30:24 +00:00
|
|
|
ppwd="$(sed -ne '/^root:/s/^root:\([^:]*\):.*$/\1/p' /etc/passwd)"
|
|
|
|
spwd="$(sed -ne '/^root:/s/^root:\([^:]*\):.*$/\1/p' /etc/shadow)"
|
2012-01-22 22:25:42 +00:00
|
|
|
|
|
|
|
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
|