2012-06-15 15:12:42 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2013-05-29 13:37:12 +02:00
|
|
|
# preperation script for my ubuntu servers
|
2012-06-15 15:12:42 +02:00
|
|
|
|
2012-06-25 17:23:23 +02:00
|
|
|
|
2012-06-27 11:22:02 +02:00
|
|
|
# **** configuration section ****
|
|
|
|
sshgroup="sshusers"
|
|
|
|
#user=$(cat /etc/passwd | grep 1000)
|
|
|
|
#user=${user:0:$(($(echo `expr index "$user" :`)-1))}
|
|
|
|
user="david"
|
|
|
|
|
|
|
|
|
|
|
|
# **** install various tools/packages ****
|
2012-06-26 12:58:00 +02:00
|
|
|
pkginstall()
|
2012-06-25 17:23:23 +02:00
|
|
|
{
|
|
|
|
|
2012-06-26 23:11:36 +02:00
|
|
|
apt-get update
|
|
|
|
apt-get dist-upgrade -y
|
2012-06-25 17:23:23 +02:00
|
|
|
apt-get install -y htop nload nmap tshark git-core \
|
2012-06-26 12:58:00 +02:00
|
|
|
curl wget dnsutils fortunes-ubuntu-server \
|
2012-06-26 23:11:36 +02:00
|
|
|
vim zsh ncdu
|
2012-06-26 12:58:00 +02:00
|
|
|
|
2012-06-25 17:23:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-06-27 11:22:02 +02:00
|
|
|
# **** configure motd ****
|
2012-06-26 23:11:36 +02:00
|
|
|
motdconfig()
|
2012-06-25 17:23:23 +02:00
|
|
|
{
|
|
|
|
|
2012-08-01 15:40:24 +02:00
|
|
|
rm /etc/update-motd.d/00*
|
2012-06-25 17:23:23 +02:00
|
|
|
rm /etc/update-motd.d/10*
|
|
|
|
rm /etc/update-motd.d/50*
|
|
|
|
|
2012-06-26 23:20:49 +02:00
|
|
|
echo ""
|
|
|
|
read -p "now its time to create/customize your /etc/motd.tail
|
2012-06-27 11:22:02 +02:00
|
|
|
(go to http://www.network-science.de/ascii/)"
|
2012-07-29 15:33:51 +02:00
|
|
|
vim /etc/motd.tail
|
2012-06-25 17:23:23 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-06-27 11:22:02 +02:00
|
|
|
|
|
|
|
# **** 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
|
|
|
|
|
2012-07-29 15:33:51 +02:00
|
|
|
read -p "add needed users to sshgroup $sshgroup in /etc/group"
|
|
|
|
vim /etc/group
|
|
|
|
|
2012-06-27 11:22:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-06-26 12:58:00 +02:00
|
|
|
# **** start of script ****
|
2012-06-27 11:22:02 +02:00
|
|
|
|
2012-06-26 23:11:36 +02:00
|
|
|
pkginstall
|
|
|
|
motdconfig
|
2012-06-27 11:22:02 +02:00
|
|
|
sshdconfig
|
|
|
|
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
# **** end of file ****
|
2012-06-25 17:23:23 +02:00
|
|
|
|
|
|
|
|