1
0
This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
svn-openwrt-archive/package/base-files/files/etc/uci-defaults/10_migrate-shadow
2013-01-18 12:46:43 +00:00

13 lines
418 B
Bash

#!/bin/sh
local ppwd="$(sed -ne '/^root:/s/^root:\([^:]*\):.*$/\1/p' /etc/passwd)"
local 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