Code: Alles auswählen
install_webinterface(){
clear;
echo -e "";
echo -e "\033[36m${LANG['install_scripts']}\033[0m";
echo -n "";
sleep 1; echo -n "."; sleep 1; echo -n "."; sleep 1; echo -e "";
CHECKUSER="`awk -F: '{print $1}' /etc/passwd | grep -x "webinterface"`"
if [ -z "$CHECKUSER" ]; then
useradd -o -u 0 -g 0 -m webinterface
else
if [ ! -d "/home/webinterface/" ]; then
mkdir "/home/webinterface/"
fi
fi
if [ ! -f "/home/webinterface/.ssh/authorized_keys" ]; then
if [ ! -d "/home/webinterface/.ssh" ]; then
mkdir "/home/webinterface/.ssh"
else
rm -r "/home/webinterface/.ssh"
mkdir "/home/webinterface/.ssh"
fi
echo -e "";
echo -e "";
echo -e "\033[36m${LANG['install_keys']}\033[0m";
echo -n "";
sleep 1; echo -n "."; sleep 1; echo -n "."; sleep 1; echo -e ""; echo -e "";
ssh-keygen -b 4096 -N '' -f /home/webinterface/.ssh/id_rsa
mv /home/webinterface/.ssh/id_rsa.pub /home/webinterface/.ssh/authorized_keys
cp /home/webinterface/.ssh/authorized_keys /home/webinterface/.ssh/id_rsa.pub
chmod +x "/home/webinterface/.ssh/"*
chmod 0644 "/home/webinterface/.ssh/"*
chmod 0755 "/home/config/scripts/"*
MOVE="`cp -a -p -r /home/config/scripts/* /home/webinterface/`"
else
echo -e "";
echo -e "";
echo -e "\033[31m${LANG['install_keys_exists1']}\033[0m";
echo -e "\033[31m${LANG['install_keys_exists2']}\033[0m";
sleep 8;
fi
sleep 2;
}