/usr/sbin/update-tcospasswd is in tcos-core 0.89.86.
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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | #!/bin/bash
#
# update-tcospasswd.sh shell script to generate tcospasswd
# to PXES, LTSP, TCOS or STANDALONE
# Copyright (C) 2006-2011 mariodebian at gmail
#
# 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.
#
if [ "$(whoami)" != "root" ]; then
echo "Error: Need to exec as root user."
exit 1
fi
_is_ltsp=$(echo /opt/ltsp*)
_is_pxes=$(echo /opt/pxes*)
_is_tcos=$(echo /etc/tcos)
_username=""
_passwd=""
_arq=""
_fpass=""
_silent=0
_noencrypted=0
_secret=0
if [ -d ${_is_ltsp} ]; then
ltsp=1
fi
if [ -d ${_is_pxes} ]; then
pxes=1
fi
if [ -d ${_is_tcos} ]; then
tcos=1
fi
for x in $@; do
case $x in
--user=*)
_username="${x#--user=}"
;;
--passwd=*)
_passwd="${x#--passwd=}"
;;
--arq=*)
_arq="${x#--arq=}"
;;
--file=*)
_fpass=${x#--file=}
;;
--silent)
_silent=1
;;
--noencrypted)
_noencrypted=1
;;
--tcosmonitor-secret)
_secret=1
;;
esac
done
make_passwd(){
$(which tcospasswd) $1
}
if [ -z $_arq ] && [ -z $_fpass ] && [ $_secret -eq 0 ]; then
echo "Arquitecture to update password:"
echo ""
if [ ${ltsp} ]; then
echo " * LTSP"
fi
if [ ${pxes} ]; then
echo " * PXES"
fi
if [ ${tcos} ]; then
echo " * TCOS"
fi
echo " * STANDALONE"
echo -n " : "
read _arq
if [ "$_arq" = "LTSP" ]; then
_fpass=/opt/ltsp/i386/etc/tcospasswd
elif [ "$_arq" = "PXES" ]; then
_fpass=$(echo /opt/pxes*)/stock/dist/etc/tcospasswd
elif [ "$_arq" = "TCOS" ]; then
_fpass=/etc/tcospasswd
elif [ "$_arq" = "STANDALONE" ]; then
_fpass=/etc/tcospasswd
else
echo "Error: Arquitecture: ${_arq} not supported, please write LTSP, PXES, TCOS or STANDALONE"
exit 1
fi
fi
if [ -z $_username ];then
echo -n "Username (usually root): "
read _username
fi
if [ -z $_passwd ];then
echo -n "TCOS Password: "
read _passwd
fi
if [ $_secret -eq 1 ];then
_fpass=/etc/tcos/secrets/tcosmonitor-secret
[ ! -d $(dirname ${_fpass}) ] && exit 0
echo "$_username:$_passwd" > ${_fpass}
chown -f root:tcos ${_fpass}
chmod -f 640 ${_fpass}
exit 0
fi
if [ $_noencrypted -eq 0 ];then
_passwd="$(make_passwd $_passwd)"
fi
string="$_username:$_passwd"
if [ $_silent -eq 0 ];then
if [ ! -d $(dirname ${_fpass}) ]; then
echo "Error: $(dirname ${_fpass}) don't exists."
exit 1
fi
echo -n "I will write this file:
${_fpass}
Continue? [Y/n] "
read _ans
if [ "${_ans}" != "n" ]; then
echo ${string} > ${_fpass}
chown -f root:tcos ${_fpass}
chmod -f 640 ${_fpass}
echo ""
echo "In case of PXES or TCOS (not STANDALONE), please update the"
echo "boot image with pxesconfig or gentcos."
echo "Done."
exit 0
fi
else
echo ${string} > ${_fpass}
chown -f root:tcos ${_fpass}
chmod -f 640 ${_fpass}
exit 0
fi
echo "Aborted."
exit 1
|