ramar.work

Setting up a Fresh Debian

VMs suck. They’re kind of a necessary element for the tools we’re using, but let’s be real. They suck. There are always lots of things to configure and lots of extra to do. Seeing as though I always have to do this, here’s a quick guide to getting Debian set up on a system. We’re going to use VirtualBox as a hypervisor. Your host operating system doesn’t matter.

If you don’t already have VirtualBox, download it and install it. You’ll also need a Debian disk. This page will get you a copy.

Create a disk (or two) depending on needs. Also make sure that two ethernet interfaces are plugged in. The other must be hostonly, so that I can log in from my current box.

Install Debian

Reboot, login as root.

Install your favorite editor and sudo

$ apt-get install sudo vim

Edit the /etc/network/interfaces file to listen to two fake ethernet interfaces.

# check the ip addresses and find the one that is NOT bound to an  IP address
$ ip addr
...
allow-hotplug enp0s8
iface enp0s8 inet static
address 192.168.56.101
broadcast 255.255.255.0

Harden up SSH just slightly

$ vim /etc/ssh/sshd_config

# Add AllowUsers, Disable passwords for SSH auth and force key file authentication
AllowUsers $USER

Generate a private key from your other box

$ ssh-keygen yourKey

Copy it to the new box (more than likely at 192.168.56.101)

ssh root@192.168.56.101 "test -d /home/$USER/.ssh || mkdir /home/$USER/.ssh"
scp yourKey.pub 192.168.56.101:/home/$USER/.ssh/
ssh root@192.168.56.101 "cat /home/$USER/.ssh/yourKey.pub >> /home/$USER/.ssh/authorized_keys && rm /home/$USER/.ssh/yourKey.pub"

Restart the ssh daemon and networking modules

ssh root@192.168.56.101
service network restart 
service sshd restart 

Check that the key works

ssh $USER@192.168.56.101