tutorials questions & answers
by

Secure your server ssh

TAGS:
  • ssh
  • server
  • ubuntu

ssh is a way you can connect to your server with full and root access so its important to secure it. One of the common attacks to ssh is brute force attack which is some cases the hackers can access to your server depending on your password strange even if they cant access to server and login in to it, the traffic of brute force attack may slow down your server and decrease your performance. there is two ways which you can secure your server ssh: First and best way is to disable ssh password login which needs almost advance knowledge of Linux and CLI but in case you are interested in this method here you can learn how to implement it . Second way and also the easy way :) for who are lazy and not expert in CLI is to disable SSH port(22) itself using UFW(Linux default firewall) in case you are not using it. So lets do this: 0- Get your server ip address and password in your dashboard => servers => manage 1- Open your local terminal and connect to your server: ssh root@youserverip then enter your password 2- Check UFW status by: sudo ufw status. by default you will see some thing like this: Status: inactive 3- Close SSH port by: sudo ufw deny ssh then you will see Rules updated massage. 4- Enable UFW by: sudo ufw enable 5- Reload UFW to use your current setting : sudo ufw reload So now if you logout from current session you will not be able to connect to SSH and your server SSH port is totally secure :) you might ask how to heck I should connect to my server? its very simple, by opening your SSH port but as you cant login via SSH itself you should use your dashboard console. 1- Navigate to dashboard => servers => manage => Click on Console icon. In the new window enter your username which is root and next type your password 2- Type sudo ufw allow ssh 3- Type sudo ufw reload Now you are able to connect to your ssh in your local terminal and other PC's. This is a good way to protect your server after deploying your app or website which you don't need to connect to your server regularly. If you are in development step I suggest you to use first method.

comments (0)

    leave comment

    Please choose login or register to comment in this thread.

    Start now for as low as $4,99 a month!

    • 8 Characters2
    • 1 Uppercase Atleast
    • 1 Number Atleast