MazaBoY Posted January 12, 2014 Report Posted January 12, 2014 In this small tutorial I'm showing the webmasters how to increase your server security by 50% in just 5 minutes.How is this possible?Most servers are getting hacked by unsecured SSH services, most of the time servers get brute forced to gain root access. Brute forcing is a hacking method by guessing the server root password, done by a script.How are we preventing this?We are going to disable root login, we are going to create a new user account. By disabling the root account, the brute forcer can't proceed because the username is unknown!How do I connect after applying this tutorial?Simply connect using the new username and password, after logged in you only have to execute 'su root' to switch to root. It will ask for the root password, once entered you are root in your server.Part 1 - Creating a new user.1. Login into your server by SSH, using PuTTY.2. Execute the following commands:useradd USERNAMEHEREpasswd USERNAMEHEREUSERNAMEHERE = Your desired login name for SSH.After executing the passwd command the console will ask you for a password. Be sure you use a secure password. (one capital, small letters, special chars and numbers. Example: RSTcenter881^359$)Now we have your new account.Part 2 - Changing the SSH settings.3. Be sure you have nano install, if not execute the following:yum install -y nano4.Now execute this:nano /etc/ssh/sshd_configScroll down and find '#Port 22' and uncomment it. Change 22 to your desired SSH port. Pick a port number between 49152 and 65535, this is recommended.Then find the line '#PermitRootLogin yes' and uncomment it. Change yes to no.Close nano by Ctrl + X, then type Y and hit enter.Part 3 - Adjusting Firewall rules.5. We need to open the port in iptables, this is done through these commands:iptables -t filter -A OUTPUT -p tcp --dport PORTNUMBERHERE -j ACCEPTiptables -t filter -A INPUT -p tcp --dport PORTNUMBERHERE -j ACCEPTservice iptables saveservice iptables restartPORTNUMBERHERE = Your port number used in the SSH config.6. Reload SSH config by executing:service sshd reloadIMPORTANT: Before you close the current Putty console, please open up a new console and try to connect using the new settings. If it works then you can close the "old" console, but it you fail to login you can always revert the settings. Quote