
Setup of basic Debian server#
I generally use Debian for the servers I run projects on. These servers are configured to only allow traffic in the door from my Bastion Host that we configured in the last post.
Setup a Debian box on Vultr using my affiliate code:
Initial setup#
- Initial update and upgrade with packages
apt-get updateapt-get upgradeapt-get install neovim
- Change root password
passwd root
- Make a new user
useradd -m username -s /bin/bashpasswd usernamesudo usermod -aG sudo {username}
- from root - get ssh over to user’s
su - rootcp -r ~/.ssh /home/usernamechown -R username:username /home/username/.ssh
- COPY OVER YOUR KEY TO home/username.ssh/authorizedkeys
scp .ssh/secret.key user@33.333.333.333:/home/user/.ssh
- Disallow root and non-key login
su - rootnvim /etc/ssh/sshd_configPasswordAuthentication > noPubkeyAuthentication > yesPermitLoginRoot > no
- On all servers, we only allow ssh access through our bastion:
sudo touch /etc/hosts.{allow,deny}
in the /etc/hosts.deny :
sshd: ALL
In vi /etc/hosts.allow :
# Whatever your jump server issshd: 11.33.54.77
You can now only ssh into your servers via your Bastion demilitarized zone. You now can install whatever software you like on these servers, run load balancers, your web services, etc.
Couple housekeeping things:#
Setup ZSH#
sudo apt-get install zsh
Bashrc configuration#
# Vi mode add to bashrcbind '"kj":vi-movement-mode'# this will cd and ls at the same time.function cd { builtin cd "$@" && ls -F }
set -o vi