1
1
Fork 0
scripts/prep_ubuntu_server.sh

84 lines
1.5 KiB
Bash
Raw Normal View History

#!/bin/bash
2013-05-29 13:37:12 +02:00
# preperation script for my ubuntu servers
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
{
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 \
curl wget dnsutils \
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 ****
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*
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
pkginstall
motdconfig
2012-06-27 11:22:02 +02:00
sshdconfig
exit 0
# **** end of file ****
2012-06-25 17:23:23 +02:00