#!/bin/bash # preperation script for my ubuntu servers # **** 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 \ vim zsh ncdu } # **** configure motd **** motdconfig() { rm /etc/update-motd.d/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 (go to http://www.network-science.de/ascii/)" vim /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 read -p "add needed users to sshgroup $sshgroup in /etc/group" vim /etc/group } # **** start of script **** pkginstall motdconfig sshdconfig exit 0 # **** end of file ****