/usr/sbin/drbl-clean-autologin-account is in drbl 2.6.15-1.
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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | #!/bin/bash
# Author: Steven Shiau <steven _at_ nchc org tw>
# License: GPL
# Description: To set the login mode for DRBL clients
# Load DRBL setting and functions
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
#
usage() {
echo "Delete the auto login accounts in DRBL."
echo "Usage: $0 [OPTION]"
echo "Options:"
language_help_prompt_by_idx_no
echo "-v, --verbose: verbose mode."
echo "-h, --host IP_ADDRESS: set only for the host with IP_ADDRESS instead of all DRBL clients"
}
#
check_if_root
#
# main
while [ $# -gt 0 ]; do
case "$1" in
-l|--language)
shift; specified_lang="$1"
shift;;
-h|--host)
shift; specified_host="$1"
shift
;;
-v|--verbose)
shift; verbose="on"
;;
-*) echo "${0}: ${1}: invalid option" >&2
usage >& 2
exit 2 ;;
*) break ;;
esac
done
ask_and_load_lang_set $specified_lang
#
if [ -n "$specified_host" ]; then
[ ! -d "$drblroot/$specified_host" ] && echo "Can NOT find DRBL client $specified_host (i.e. no $drblroot/$specified_host)! Assume it's DRBL SSI client."
[ -n "$verbose" ] && echo "specified_host: $specified_host"
fi
# set the host to be processed
# host_list is the IP address of client, like 192.168.1.1...
host_list=""
if [ -n "$specified_host" ]; then
# set the host path
host_list=$drblroot/$specified_host
else
# withoud specified_host, it must be all clients, append each one to $host_list
for ihost in `get-client-ip-list`; do
host_list="$host_list $drblroot/$ihost"
done
fi
account_list=
# get the autologin account
echo -n "Finding the auto login accounts..."
for ihost in $host_list; do
iaccount="`get_existing_autologin_account $ihost`"
account_list="$account_list $iaccount"
echo -n "."
done
echo " done!"
# remove the leading space
account_list=`echo $account_list | sed -e "s/^ //g"`
[ -z "$account_list" ] && echo "No autologin account! Program terminated!" && exit 1
#
[ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
echo "$msg_r_u_sure_want_to_del_autologin_accounts"
echo "$msg_these_accounts_are:"
[ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
echo "$account_list"
[ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
echo "$msg_are_u_sure_u_want_to_continue"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "[y/N] "
read delete_account_confirm
case "$delete_account_confirm" in
Y|y|[yY][eE][sS])
echo "$msg_ok_let_do_it!"
;;
*)
echo "$msg_do_not_del_accounts! $msg_program_stop!!!"
exit 0
esac
[ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
echo "$msg_also_clean_autologin_accounts"
echo "$msg_these_accounts_are:"
[ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
echo "$account_list"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "[y/N] "
read clean_home
case "$clean_home" in
y|Y|[yY][eE][sS])
[ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
echo "$msg_warning_home_dir_will_be_deleted!!!"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "[y/N] "
read clean_home_confirm
case "$clean_home_confirm" in
y|Y|[yY][eE][sS])
RM_HOME_OPT="-r"
;;
esac
;;
esac
for id in $account_list; do
echo -n "Deleting account $id..."
[ -n "$RM_HOME_OPT" ] && echo -n "and his/her home directory..."
/usr/sbin/userdel $RM_HOME_OPT $id
echo "done!"
done
echo "Updating YP..."
make -C /var/yp
echo "done!"
|