diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2016-08-31 11:57:02 +0200 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2016-08-31 12:12:29 +0200 |
commit | 156b283772b7c2fa228f8b5896eee0cd2f12f477 (patch) | |
tree | f23ae2fd565d865151e8f0d5df29fb3cd903882a /shadowconvert.sh | |
parent | 0f36ef23862c65f83ade94d068b354a7c1f70bee (diff) | |
download | setup-156b283772b7c2fa228f8b5896eee0cd2f12f477.tar setup-156b283772b7c2fa228f8b5896eee0cd2f12f477.tar.gz setup-156b283772b7c2fa228f8b5896eee0cd2f12f477.tar.bz2 setup-156b283772b7c2fa228f8b5896eee0cd2f12f477.tar.xz setup-156b283772b7c2fa228f8b5896eee0cd2f12f477.zip |
include shadowconvert.sh in sources
Diffstat (limited to 'shadowconvert.sh')
-rwxr-xr-x | shadowconvert.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/shadowconvert.sh b/shadowconvert.sh new file mode 100755 index 0000000..4be13b6 --- /dev/null +++ b/shadowconvert.sh @@ -0,0 +1,18 @@ +#!/bin/bash +if [ x`pwd` = "x/etc" ] +then + echo Cannot operate directly on \"/etc\". >&2 + exit 1 +fi + +#make prototype for /etc/shadow +sed -e "s/:.*/:*:`expr $(date +%s) / 86400`:0:99999:7:::/" passwd >shadow + +#make prototype for /etc/gshadow +sed -e 's/:[0-9]\+:/::/g' group >gshadow + +#mark passwd and group files entries shadowed +sed -i -e 's/^\([^:]\+\):[^:]*:/\1:x:/' passwd group + +echo Converted successfully. +exit 0 |