Skip to content

Instantly share code, notes, and snippets.

@atuanpham
Last active May 23, 2018 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save atuanpham/d16859fb5c5a465e8834e5dedbb8865f to your computer and use it in GitHub Desktop.
Save atuanpham/d16859fb5c5a465e8834e5dedbb8865f to your computer and use it in GitHub Desktop.
Initial Ubuntu Server (16.04)

/etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
    address 10.0.0.41
    netmask 255.255.255.0
    network 10.0.0.0
    broadcast 10.0.0.255
    gateway 10.0.0.1
    dns-nameservers 10.0.0.1 8.8.8.8
    dns-domain acme.com
    dns-search acme.com

Update network configs

sudo ifdown eth0
sudo ifup eth0
  • Create new user:

adduser sammy

  • Add this user to sudo group:

usermod -aG sudo sammy

  • Configure SSH Key-Based Authentication:
mkdir ~/.ssh
chmod 700 ~/.ssh
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
  • Setup Firewall:

Make sure that OpenSSH is listed in the registered profiles of UFW.

sudo ufw app list

Add OpenSSH to allowed list

sudo ufw allow OpenSSH

Enable the firewall:

sudo ufw enable

Check status of the firewall:

sudo ufw status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment