Misc
August 4, 2020

Configuring a new server

1. Add a new user:

adduser username 

2. Add this user to sudoers group:

usermod -aG sudo username

3. Switch to this user:

su - username

4. Open the ssh configuration file:

vim /etc/ssh/sshd_config

5. In the line PermitRootLogin yes replace the word Yes with the word No:

PermitRootLogin no

6. In the line #PasswordAuthentication yes replace the word Yes with the word No and uncomment this line:

PasswordAuthentication no

7. Add your id_rsa.pub to autorized_keys (run it from the client):

ssh-copy-id username@remote_host

8. Save the file and restart the service:

sudo service ssh restart

9. Install curl:

sudo apt update && sudo apt install curl -y 

10. Download openvpn-installer:

curl -O https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh

11. Add execution permission:

chmod +x openvpn-install.sh

12. Then run it:

sudo ./openvpn-install.sh

13. Create ssh "bookmark" (run it from the client):

echo "Host dev
     HostName 0.0.0.0
     User username
     Port 22
 " >> ~/.ssh/config

14. Copy *.ovpn files to your PC (run it from the client):

scp dev:~/*.ovpn ~/Downloads/