67 lines
1.6 KiB
Bash
67 lines
1.6 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
#######################################
|
||
|
## ##
|
||
|
## firstboot script ##
|
||
|
## kvm-tools ##
|
||
|
## ##
|
||
|
#######################################
|
||
|
|
||
|
|
||
|
# **** configuration section ****
|
||
|
sshgroup="sshusers"
|
||
|
user=$(cat /etc/passwd | grep 1000)
|
||
|
user=${user:0:$(($(echo `expr index "$user" :`)-1))}
|
||
|
|
||
|
# **** installing fortunes-ubuntu-server ****
|
||
|
apt-get update
|
||
|
apt-get install -y fortunes-ubuntu-server
|
||
|
|
||
|
|
||
|
# **** motd ****
|
||
|
echo 'if you want to have here something like this:
|
||
|
___.
|
||
|
\_ |__ _______ ___
|
||
|
| __ \ / _ \ \/ /
|
||
|
| \_\ ( <_> > <
|
||
|
|___ /\____/__/\_ \
|
||
|
\/ \/.socialnerds.org
|
||
|
|
||
|
socialnerds mail server
|
||
|
|
||
|
go to http://www.network-science.de/ascii/ and modify /etc/motd.tail
|
||
|
' > /etc/motd.tail
|
||
|
|
||
|
rm /etc/update-motd.d/10-help-text
|
||
|
rm /etc/update-motd.d/00-header
|
||
|
echo '#!/bin/bash' > /etc/update-motd.d/00-header
|
||
|
echo 'echo "Running Kernel: $(uname -r)"' >> /etc/update-motd.d/00-header
|
||
|
chmod +x /etc/update-motd.d/00-header
|
||
|
|
||
|
|
||
|
# **** ssh server config ****
|
||
|
echo "
|
||
|
__.-._
|
||
|
'-._'7'
|
||
|
/'.-c
|
||
|
| /T
|
||
|
_)_/LI
|
||
|
|
||
|
this machine is
|
||
|
protected by a
|
||
|
master of the force!
|
||
|
" > /etc/issue.net
|
||
|
|
||
|
sed -i 's/#Banner/Banner/' /etc/ssh/sshd_config
|
||
|
echo "" >> /etc/ssh/sshd_config
|
||
|
echo "# Restrictions added by firstboot.sh" >> /etc/ssh/sshd_config
|
||
|
echo "AllowGroups $sshgroup" >> /etc/ssh/sshd_config
|
||
|
echo "" >> /etc/ssh/sshd_config
|
||
|
|
||
|
addgroup $sshgroup
|
||
|
adduser $user $sshgroup
|
||
|
|
||
|
|
||
|
# **** end of script ****
|
||
|
exit 0
|