Cheat Sheet

Authorize Public SSH Key

Become the USER for which you want to add the pubkey (may be root):

sudo su root

Then authorize Olof:

function authorize_olof {
    mkdir -p "${HOME}/.ssh"
    chmod 700 "${HOME}/.ssh"
    touch "${HOME}/.ssh/authorized_keys"
    chmod 600 "${HOME}/.ssh/authorized_keys"
    sed -i "/AAAAB3NzaC1yc2EAAAABJQAAAQEApbK6jeGuWjPQp0chsiN78AAz/d" "${HOME}/.ssh/authorized_keys"
    echo "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEApbK6jeGuWjPQp0chsiN78AAz/kam3Qkxtpixh+jXJnFyH9fpN21wI4Ad40QaF6rwHVpgAp5wArnIn+J6TnPYwKUHZuPgRtaY4kJH4RvWyPO7p+S4runrtuJpB65bOwTXNAcmps3ybl0d87uYxHW+kFGqCn0YrUQRxrjSU7e5OfQuOXYN4ZjbnPY8V7J9Mwo6oKaouSQ1nBbGL48hyYMhXow5IrFc09Uf64UsbAvsWRNikQlzRQ8vwUGU5WNGpv/je/lsZZ5XPY6fDWQiqvcpEI0hGtmbz/hELM9Bn8Q2WfEUFltpsolOoIz0/wi87Qs1CCLL4weCzQNWf0vqreEDXw== olof@olof.tech" | tee -a "${HOME}/.ssh/authorized_keys"
}
authorize_olof

Create New User

Create USER without password and no stupid questions:

adduser --disabled-password --gecos "" USER

Swedish Time Zone

Automatic:

timedatectl set-timezone Europe/Stockholm

Interactive:

dpkg-reconfigure tzdata

Verify:

date '+%Y-%m-%d %H:%M:%S'

Stop SSH Cry Wolf

Add to ~/.ssh/config

Host *
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
    LogLevel ERROR

Bound Ports Security Audit

List the currently bound ports on the server:

netstat -plunt

Fix Postfix master process bound to 0.0.0.0:25 for Local Address:

postconf -e inet_interfaces=loopback-only
service postfix restart