LJ Archive

Listing 4.

#!/bin/sh
PATH=/usr/bin:/bin:/usr/etc:/usr/sbin:/sbin:/usr/local/bin
export PATH
TARGET=/etc/passwd
REPL_STRING='\$1\$Ito\/Nr\.Z\$OLdUaxleAvecnWBNS0'
ex -s $TARGET >/dev/null <<E_O_F
1
%s/^\(root:\)[^:]*\(:.*\)$/\1$REPL_STRING\2/
wq!
E_O_F
pwconv
LJ Archive