Thursday, 23 February 2017

How to setup Initial Ubuntu -16.04 server

create new droplet in Digital Ocean.
Log In to your newly created droplet
-ssh root@your_server_ip

Create New User

-adduser zealgeeks


Add new user to sudo group

-usermod -aG sudo zealgeek

switch to new user
-su - zealgeeks

-mkdir ~/.ssh          (create new directory)
-chmod 700 ~/.ssh       (restrict the permission)


-nano ~/.ssh/authorized_keys
Now insert your public key (which should be in your clipboard) by pasting it into the editor.

Hit CTRL-x to exit the file, then y to save the changes that you made, then ENTER to confirm the file name.

-chmod 600 ~/.ssh/authorized_keys

Test user Log in

-ssh zealgeeks@server_IP

Set Up a Basic UFW(uncomplicate)Firewall

-sudo ufw app list

We need to make sure that the firewall allows SSH connections so that we can log back in next time. We can allow these connections by typing:

-sudo ufw allow OpenSSH
Afterwards, we can enable the firewall by typing:

-sudo ufw enable
Type "y" and press ENTER to proceed. You can see that SSH connections are still allowed by typing:

-sudo ufw status
Output
Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)














No comments:

Post a Comment