How to Secure Login URL in Linux or cPanel?

Posted at April 16, 2017 at 9:41 pm by Jithin

For Content Management systems like WordPress and Joomla need more protection. We need to restrict the login URL from public access. This will prevent a large numbers of brute-force attempts. Additionally this will help the server’s load.  This can be configured in different methods. Some of the methods are given below:

 

Setup IP restriction on htaccess

Open .htaccess file and add the below code.

# vi .htaccess

<Files “file name”>

Order Deny,Allow

Deny from all

Allow from <from which IP you want to access the file>

</Files>

 

Setup IP restriction in apache configuration file

Open apache configuration file and add the code below to restrict the access to a file from all unwanted IP’s.

<Location filename>

Order deny,allow

Deny from all

Allow from from <from which IP you want to access the file>

</Location>

After making the changes we need to restart the apache service to enable the changes.

# systemctl restart httpd

 

Enable password protection for a directory

1) Open apache configuration file and add the code below to the file.

<Location filename>

AuthUserFile location of htpasswd/.htpasswd

AuthName “Password Protected Area”

AuthType Basic

Require valid-user

</Location>

 

2) Now create new htpassword for a new user using the following command.

# htpasswd -cm location of htpasswd/.htpasswd myuser

 

3) You need to enter the password for the user.

 

4) After creating htpassword file, the apache service needs to be restarted.

# systemctl restart httpd

By following the method above, when you access the secure directory/file it will ask for the login credentials.

 

Enable password protection for a directory using cPanel

1) Log in to cPanel.

2) Navigate to the option ‘Directory Privacy’ under ‘Files’ section.

3) Click on the directory you want to enable password protection.

4) Select Password protect this directory check box under Security Settings.

5) Enter a name to the protected directory on Enter a name for the protected directory text box.

6) Click Save button to make the changes.

7) Create a user to access the directory. Enter a username in the Username text box under Create User.

8) Enter password for the newly created user.

9) Finally click on save button to enable all changes.

 

If you need any further help please contact our support department.

 

 

0.00 avg. rating (0% score) - 0 votes

You can skip to the end and leave a response. Pinging is currently not allowed.

Leave a Reply