New Host Flight Manual
First steps for any new hosts. Written initially for Ubuntu 18.04.
Add new user to sudoers, copy ssh key, test login
As root, create new sudo user:
adduser uninen
adduser uninen sudo
On local machine:
scp .ssh/id_rsa.pub uninen@<new-host-ip>:/home/uninen/scully.pub
On remote achine as new user, first create ssh-keys, then add copied key to authorized keys:
ssh-keygen
cat scully.pub > .ssh/authorized_keys
Now test login.
Disable Root Login
sudo nano /etc/ssh/sshd_config
Add: PermitRootLogin: no
sudo service sshd restart
Set Up Firewall And Change SSH port
sudo ufw enable
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow 2269
You can check open ports and ufw status with:
netstat -atun ufw status verbose
Now edit /etc/ssh/sshd_config again and change port to something else than 22. More in DO ufw tutorial.
Misc
Set timezone
sudo timedatectl set-timezone Europe/Helsinki
Generate and set locale
sudo locale-gen fi_FI.UTF-8
sudo nano /etc/default/locale
And put following in:
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_ALL=fi_FI.UTF-8
Now, reboot.
Installing MySQL
sudo apt install mysql-server
sudo mysql_secure_installation
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';