/usr/sbin/update-dpsyco-users-shell is in dpsyco-base 1.0.36.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | #!/bin/sh
# DocumentId: $Id: update-dpsyco-users-shell 2576 2008-04-07 20:00:51Z ola $
# Author: $Author: ola $
# Date: $Date: 2008-04-07 22:00:51 +0200 (mån, 07 apr 2008) $
# Summary:
# Updates the shell accounts.
#
# Copyright (C) 2001-2004 Ola Lundqvist <opal@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
# Read the default dpsyco config.
. /etc/dpsyco/defaults.conf
TESTNFS="/ $DHOME /etc"
. /usr/share/dpsyco/checknfs.test
# Users that exist in password file.
EUSERS=$(grep "^[^:]*:[^:]*:$UID_MATCH:" $PWDF | sed -e "s|:.*||g;")
# Users that should have shell access.
FUSERS=$(find $USERSRC -maxdepth 3 -path "$USERSRC/*/*" -type f -name "shell" | sed -e "s|/shell||;" | sed -e "s|.*/||;" | sort -u)
for U in $EUSERS ; do
# Modify the user information for all users that should exist.
. $USERSC
if [ -f $USERSRC/$U ] ; then
. $USERSRC/$U
fi
if [ ! -z "$CRYPT" ] ; then
if echo "$FUSERS" | grep "^$U\$" > /dev/null 2>&1 ; then
# User should have shell access.
if ! grep "^$U:$CRYPT:" $SHDF > /dev/null 2>&1 ; then
echo "Updating password for user $U."
usermod -p "$CRYPT" $U
fi
else
# User should not have shell access.
if ! grep "^$U:X:" $SHDF > /dev/null 2>&1 ; then
if [ "$SUDO_USER" = "$U" -o "$USER" = "$U" ] ; then
echo "Can not remove the password for the user you are logged in as."
echo "So you have to do that manually by typing:"
echo " usermod -p X $U"
else
echo "Updating password for user $U (no shell access)."
usermod -p X $U
fi
fi
fi
else
# User should not have shell access.
if ! grep "^$U:x:" $SHDF > /dev/null 2>&1 ; then
if [ "$SUDO_USER" = "$U" -o "$USER" = "$U" ] ; then
echo "Can not remove the password for the user you are logged in as."
echo "So you have to do that manually by typing:"
echo " usermod -p x $U"
else
echo "Updating password for user $U (no password found)."
usermod -p x $U
fi
fi
fi
if [ ! -z "$SHELL" ] ; then
if ! grep ":$SHELL\$" $PWDF > /dev/null 2>&1 ; then
usermod -s $SHELL $U
fi
fi
done
|