84 lines
1.5 KiB
Bash
Executable File
84 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
# preperation script for my ubuntu servers #
|
|
# can be used as firstboot script for vm-builder #
|
|
# # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
|
|
|
# **** configuration section ****
|
|
sshgroup="sshusers"
|
|
#user=$(cat /etc/passwd | grep 1000)
|
|
#user=${user:0:$(($(echo `expr index "$user" :`)-1))}
|
|
user="david"
|
|
|
|
|
|
# **** install various tools/packages ****
|
|
pkginstall()
|
|
{
|
|
|
|
apt-get update
|
|
apt-get dist-upgrade -y
|
|
apt-get install -y htop nload nmap tshark git-core \
|
|
curl wget dnsutils fortunes-ubuntu-server \
|
|
vim zsh ncdu
|
|
|
|
}
|
|
|
|
|
|
# **** configure motd ****
|
|
motdconfig()
|
|
{
|
|
|
|
rm /etc/update-motd.d/10*
|
|
rm /etc/update-motd.d/50*
|
|
|
|
echo ""
|
|
read -p "now its time to create/customize your /etc/motd.tail
|
|
(go to http://www.network-science.de/ascii/)"
|
|
vi /etc/motd.tail
|
|
|
|
}
|
|
|
|
|
|
# **** ssh server config ****
|
|
sshdconfig()
|
|
{
|
|
|
|
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 ubuntu server prep script" >> /etc/ssh/sshd_config
|
|
echo "AllowGroups $sshgroup" >> /etc/ssh/sshd_config
|
|
echo "" >> /etc/ssh/sshd_config
|
|
|
|
addgroup $sshgroup
|
|
adduser $user $sshgroup
|
|
|
|
}
|
|
|
|
|
|
# **** start of script ****
|
|
|
|
pkginstall
|
|
motdconfig
|
|
sshdconfig
|
|
|
|
|
|
exit 0
|
|
# **** end of file ****
|
|
|
|
|