source: projects/setup/trunk/shadowconvert.sh @ 8717

Revision 8717, 420 bytes checked in by daisuke, 8 years ago (diff)

add initial version

  • Property svn:executable set to *
Line 
1#!/bin/bash
2if [ x`pwd` = "x/etc" ]
3then
4  echo Cannot operate directly on \"/etc\". >&2
5  exit 1
6fi
7
8#make prototype for /etc/shadow
9sed -e "s/:.*/:*:`expr $(date +%s) / 86400`:0:99999:7:::/" passwd >shadow
10
11#make prototype for /etc/gshadow
12sed -e 's/:[0-9]\+:/::/g' group >gshadow
13
14#mark passwd and group files entries shadowed
15sed -i -e 's/^\([^:]\+\):[^:]*:/\1:x:/' passwd group
16
17echo Converted successfully.
18exit 0
Note: See TracBrowser for help on using the repository browser.