diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2012-01-22 22:25:42 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2012-01-22 22:25:42 +0000 |
commit | 6b9bf718816a9bada8dcfd38d7a05c38cd1cdc4c (patch) | |
tree | fe6f5485d1e7a722f5fe142634b93b8226dd8c67 /package/base-files/files/etc | |
parent | 0e81a543a92952e205aab5a31b095c1ec9196ca6 (diff) | |
download | upstream-6b9bf718816a9bada8dcfd38d7a05c38cd1cdc4c.tar.gz upstream-6b9bf718816a9bada8dcfd38d7a05c38cd1cdc4c.tar.bz2 upstream-6b9bf718816a9bada8dcfd38d7a05c38cd1cdc4c.zip |
base-files: add a uci-defaults script which will migrate the root password to /etc/shadow if needed
SVN-Revision: 29865
Diffstat (limited to 'package/base-files/files/etc')
-rw-r--r-- | package/base-files/files/etc/uci-defaults/migrate-shadow | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/package/base-files/files/etc/uci-defaults/migrate-shadow b/package/base-files/files/etc/uci-defaults/migrate-shadow new file mode 100644 index 0000000000..b7ea5718c9 --- /dev/null +++ b/package/base-files/files/etc/uci-defaults/migrate-shadow @@ -0,0 +1,12 @@ +#!/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 |