Security
Introduction
Initial Connection
Sign in to your VPS through your root user to begin the procedure.
Staying up-to-date!
One of the first thing you'll want to do whenever you setup a VPS, is to make sure that you're using the latest and greatest stuff available.
Terminal Shell
Shell Installation
Default oh-my-zsh settings
Setup .zshrc in /etc/skel for new users
Copy .zshrc to the root user
powerlevel9k theme
Powerline Fonts (optional?)
Theme
Use custom theme settings vim /usr/share/oh-my-zsh/powerlevel9k.sh
Change shell
Reboot
User Account
Next, you'll want to create a new user account. It is considered bad practice to run anything through the root user, and you certainly shouldn't be the one exception. You are however, giving the new user account access to the sudo group for elevated permissions.
Immediately after executing the above command, you'll be prompted to enter a password a total of two times.
TIP
Although not required — it is strongly recommended to use 1Password to generate the password, using a length of 30 characters, 8 digits and 0 symbols.
Generating an SSH Key
WARNING
Generating the SSH key needs to be done on your local machine, NOT on the VPS.
Another security measure you are going to adopt is to disable password authentication, and only rely on SSH keys. In order to do so though, you must first generate a SSH key on your local machine.
Immediately after executing the above command, you'll be prompted to enter a password a total of three times.
TIP
Although not required — it is strongly recommended to use 1Password to generate the password, using a length of 30 characters, 8 digits and 0 symbols.
Make sure the SSH key has the correct permissions by executing the following command:
Dependencies
If you haven't already, you'll need to install ssh-copy-id from Homebrew (OS X).
Activation
Once the dependencies are installed, you need to copy your newly generated SSH key over to the VPS. This will allow us to disable password authentication and replace it with SSH authentication in the next step.
Confirmation
This step is optional, but if you would like to verify that the SSH key was successfully transferred across — execute the following command on your VPS.
You should see an entry with <variable identifier="Email Address" /> (RSA) highlighted.