1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#! /bin/sh
set -e
sed -n '/^\//q;1,/^\//p' /etc/shells > /etc/shells.tmp
grep '^[[:space:]]*/' /etc/shells |
while read shell
do
dir=`dirname $shell`
if [ "x`basename $dir`" != "xlshells" ]
then
echo $shell >> /etc/shells.tmp
else
echo "`dirname $dir`/`basename $shell`" >> /etc/shells.tmp
fi
done
cp /etc/shells /etc/shells.old
cp /etc/shells.tmp /etc/shells
rm /etc/shells.tmp
cat /etc/passwd |
awk '{ FS=":"
if ( $3 < 100 ) next
if ( $7 == "" || $7 == "/bin/false" || $7 == "/bin/sync" ) next
print $1,$7
}' |
while read user shell
do
grep -v $shell /etc/shells.old >/dev/null 2>&1
if [ $? -eq 0 ]
then
dir=`dirname $shell`
if [ "x`basename $dir`" = "xlshells" ]
then
shell="`dirname $dir`/`basename $shell`"
chsh -s $shell $user
fi
fi
done
/bin/rm -f /etc/shells.old
#DEBHELPER#
exit 0
|