Skip to main content
  1. Posts/

How I Initially setup a Debian Server

·241 words·2 mins·
Technology Linux
Joshua Blais
Author
Joshua Blais
Table of Contents

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
#

  1. Initial update and upgrade with packages
apt-get update
apt-get upgrade
apt-get install neovim
  1. Change root password
passwd root
  1. Make a new user
useradd -m username -s /bin/bash
passwd username
sudo usermod -aG sudo {username}
  1. from root - get ssh over to user’s
su - root
cp -r ~/.ssh /home/username
chown -R username:username /home/username/.ssh
  1. COPY OVER YOUR KEY TO home/username.ssh/authorizedkeys
scp .ssh/secret.key user@33.333.333.333:/home/user/.ssh
  1. Disallow root and non-key login
su - root
nvim /etc/ssh/sshd_config
PasswordAuthentication > no
PubkeyAuthentication > yes
PermitLoginRoot > no
  1. 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 is
sshd: 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 bashrc
bind '"kj":vi-movement-mode'
# this will cd and ls at the same time.
function cd {
    builtin cd "$@" && ls -F
    }

set -o vi