How to prevent direct file access from a directory on server?

Friends, Here is a simple approach to prevent the direct file access from a directory on a server.

To do this we need to create a file .htaccess and just write a single line of code:

To prevent direct file access put the .htaccess file with the above line of code in the directory containing the file.

Sample Directory Without .htaccess File:
server1

Output when accessing the pages/page1.html:
sout1

Sample Directory With .htaccess File:
server3

Output when accessing the pages/page1.html:
sout2

To prevent direct file access from a directory, just place the .htaccess file with following lines of text i.e. “Deny From All” in that directory.

How to create a application on AWS(Amazon Web Services)?

To create a webapplication on the AWS follows the steps given below

Step:1 Create a Elastic Beanstalk by clicking on the Elastic Beanstalk link on the AWS dashboard.

Beanstalk1

Step:2 Click on create new application.

Beanstalk2

Step:3 Fill in all the details for the environment configuration details which includes the security group and key pair name setting which is used to connect the ftp client with the server.

Beanstalk5

Step:4 Fill in the details for the Database instance.

Beanstalk6

After doing all the above steps your application and environment will be set up.

How to convert .pem file to .ppk file?

Question:- What is .pem file?

Answer: .pem Defined in RFC’s 1421 through 1424, this is a container format that may include just the public certificate (such as with Apache installs, and CA certificate files /etc/ssl/certs), or may include an entire certificate chain including public key, private key, and root certificates. The name is from Privacy Enhanced Email, a failed method for secure email but the container format it used lives on.

Question:- What is .ppk file?

Answer: The PPK file type is primarily associated with ‘PuTTY’. PuTTY is a terminal emulator application which can act as a client for the SSH, Telnet, rlogin, and raw TCP computing protocols. The name PuTTY has no definitive meaning, though tty is the name for a terminal in the Unix tradition, usually held to be short for teletype.

Benefit of converting .pem to .ppk file

PuTTY does not natively support the private key format generated. So it is advisable to convert the .pem file to .ppk so that it can be easily recognized by the FTP Clients like Filezilla, winSCP etc.

How to Convert .pem file to .ppk file?

Step-1: Start PuTTYgen (e.g., from the Start menu, click All Programs > PuTTY > PuTTYgen). if you don’t have puttyGen in your system download it from here.

Beanstalk9

Step-2: Click Load and browse to the location of the private key file that you want to convert (e.g., GSG_Keypair.pem). By default, PuTTYgen displays only files with extension .ppk; you’ll need to change that to display files of all types in order to see your.pem key file. The private key file must end with a newline character or PuTTYgen cannot load it correctly.

puttygen

Step-3:
When you click OK, PuTTYgen displays a dialog box with information about the key you loaded, such as the public key and the fingerprint. Click Save private key to save the key in PuTTY’s format. Select a passphrase and save your private key somewhere secure if you click on save without giving a passphrase it will ask you whether you want to save it without passphrase.

Beanstalk11

Step-4: Save the file with the suitable name. You will get the desired .ppk file

Beanstalk12

Note: A passphrase on a private key is an extra layer of protection, so even if your private key is discovered, it will not be usable without the passphrase. The downside to using a passphrase is that it makes automation harder because human intervention is needed to log on to an instance, or copy files to an instance. For this exercise, we’re not using a passphrase.

How to change Apache Tomcat server username and password?

It’s very simple to change the Apache Tomcat Web Server username and password for the admin in case you have forgot.

To do so Locate the Apache Tomcat folder or the folder where you have installed your Apache Tomcat Server. On windows generally it can be found on C Drive (may vary according to your installation).

Here taking my example: I have installed my Apache Tomcat Web Server on C drive.
So to change the username and password visit the root directory of your Apache Tomcat Web Server.

The complete path (in my case) is as:

Again this may vary according to your installation:

or

Now Open the “conf” folder and look for “tomcat-users.xml” file
tomcat1

Open the “tomcat-users.xml” file. You will get the similar look(if opened in notepad++ editor).
tomcat-users.xml
Just look at the highlighted code and make sure this line exist and is enabled in your own “tomcat-users.xml” file. If this line is not there enter it manually or copy paste from here:

Change the username and password as per your convenience. Restart the Server and you are done with username and password change!

How to remove forbidden or permission denied error on accessing wamp server on localhost?

Error:
Forbidden You don’t have permission to access / on this server.

TO RESOLVE THE ABOVE ERROR WE NEED TO MAKE THE FOLLOWING CHANGES IN httpd.conf FILE LOCATED AT for e.g. C:\wamp\bin\apache\apache2.2.22\conf\htpd.conf

Look through the httpd.conf file and make changes as follows:
1.

2.

Try it!
Good Luck :)