iSnare.com - Free Content Articles Directory
Authors Contents [Advanced Search][Add OpenSearch][Job Search]
Distribute your articles to thousands of article sites for only $2 and below! Read more...

Index  Internet
 

6 Tips To Secure Your Website

 
[ Contact the Author] [ Send to a Friend] [ Article Publisher] [Make PDF] [ Print] [ Bookmark & Share]
 
Read our Terms of Service before reprinting this article. The submitter specified above has claimed the rights to this article.
David Risley

Most people on the internet are good, honest people. However, there are some people browsing the internet who derive fun from poking around websites and finding security holes. A few simple tips can help you secure your website in the basic ways. Now, obviously, the subject of data security is a complicated one and way beyond the scope of this column. However, I will address the very basics one should do which will alleviate many potential problems that might allow people to see things they shouldn't.

Password Protecting Directories

If you have a directory on your server which should remain private, do not depend on people to not guess the name of the directory. It is better to password protect the folder at the server level. Over 50% of websites out there are powered by Apache server, so let's look at how to password protect a directory on Apache.

Apache takes configuration commands via a file called .htaccess which sits in the directory. The commands in .htaccess have effect on that folder and any sub-folder, unless a particular sub-folder has its own .htaccess file within. To password protect a folder, Apache also uses a file called .htpasswd . This file contains the names and passwords of users granted access. The password is encrypted, so you must use the htpasswd program to create the passwords. To access it, go to the command line of your server and type htpasswd. If you receive a "command not found" error then you need to contact your system admin. Also, bear in mind that many web hosts provide web-based ways to secure a directory, so they may have things set up for you to do it that way rather than on your own. Barring this, let's continue.

Type "htpasswd -c .htpasswd myusername" where "myusername" is the username you want. You will then be asked for a password. Confirm it and the file will be created. You can double check this via FTP. Also, if the file is inside your web folder, you should move it so that it is not accessible to the public. Now, open or create your .htaccess file. Inside, include the following:

AuthUserFile /home/www/passwd/.htpasswd
AuthGroupFile /dev/null
AuthName "Secure Folder"
AuthType Basic

require valid-user


On the first line, adjust the directory path to wherever your .htpasswd file is. Once this is set up, you will get a popup dialog when visiting that folder on your website. You will be required to log in to view it.

Turn Off Directory Listings

By default, any directory on your website which does not have a recognized homepage file (index.htm, index.php, default.htm, etc.) is going to instead display a listing of all the files in that folder. You might not want people to see everything you have on there. The simplest way to protect against this is to simply create a blank file, name it index.htm and then upload it to that folder. Your second option is to, again, use the .htaccess file to disable directory listing. To do so, just include the line "Options -Indexes" in the file. Now, users will get a 403 error rather than a list of files.

Remove Install Files

If you install software and scripts to your website, many times they come with installation and/or upgrade scripts. Leaving these on your server opens up a huge security problem because if somebody else is familiar with that software, they can find and run your install/upgrade scripts and thus reset your entire database, config files, etc. A well written software package will warn you to remove these items before allowing you to use the software. However, make sure this has been done. Just delete the files from your server.

Keep Up with Security Updates

Those who run software packages on their website need to keep in touch with updates and security alerts relating to that software. Not doing so can leave you wide open to hackers. In fact, many times a glaring security hole is discovered and reported and there is a lag before the creator of the software can release a patch for it. Anybody so inclined can find your site running the software and exploit the vulnerability if you do not upgrade. I myself have been burned by this a few times, having whole forums get destroyed and having to restore from backup. It happens.

Reduce Your Error Reporting Level

Speaking mainly for PHP here because that's what I work in, errors and warnings generated by PHP are, by default, printed with full information to your browser. The problem is that these errors usually contain full directory paths to the scripts in question. It gives away too much information. To alleviate this, reduce the error reporting level of PHP. You can do this in two ways. One is to adjust your php.ini file. This is the main configuration for PHP on your server. Look for the error_reporting and display_errors directives. However, if you do not have access to this file (many on shared hosting do not), you can also reduce the error reporting level using the error_reporting() function of PHP. Include this in a global file of your scripts that way it will work across the board.

Secure Your Forms

Forms open up a wide hole to your server for hackers if you do not properly code them. Since these forms are usually submitted to some script on your server, sometimes with access to your database, a form which does not provide some protection can offer a hacker direct access to all kinds of things. Keep in mind...just because you have an address field and it says "Address" in front of it does not mean you can trust people to enter their address in that field. Imagine your form is not properly coded and the script it submits to is not either. What's to stop a hacker from entering an SQL query or scripting code into that address field? With that in mind, here are a few things to do and look for:

Use MaxLength. Input fields in form can use the maxlength attribute in the HTML to limit the length of input on forms. Use this to keep people from entering WAY too much data. This will stop most people. A hacker can bypass it, so you must protect against information overrun at the script level as well.

Hide Emails If using a form-to-mail script, do not include the email address into the form itself. It defeats the point and spam spiders can still find your email address.

Use Form Validation. I won't get into a lesson on programming here, but any script which a form submits to should validate the input received. Ensure that the fields received are the fields expected. Check that the incoming data is of reasonable and expected length and of the proper format (in the case of emails, phones, zips, etc.).

Avoid SQL Injection. A full lesson on SQL injection can be reserved for another article, however the basics is that form input is allowed to be inserted directly into an SQL query without validation and, thus, giving a hacker the ability to execute SQL queries via your web form. To avoid this, always check the data type of incoming data (numbers, strings, etc.), run adequate form validation per above, and write queries in such a way that a hacker cannot insert anything into the form which would make the query do something other than you intend.

Conclusion

Website security is a rather involved subject and it get a LOT more technical than this. However, I have given you a basic primer on some of the easier things you can do on your website to alleviate the majority of threats to your website.

Important NoticeDISCLAIMER: All information, content, and data in this article are sole opinions and/or findings of the individual user or organization that registered and submitted this article at Isnare.com without any fee. The article is strictly for educational or entertainment purposes only and should not be used in any way, implemented or applied without consultation from a professional. We at Isnare.com do not, in anyway, contribute or include our own findings, facts and opinions in any articles presented in this site. Publishing this article does not constitute Isnare.com's support or sponsorship for this article. Isnare.com is an article publishing service. Please read our Terms of Service for more information.

David Risley is a web developer and founder of PC Media, Inc. (http://www.pcmedianet.com). Specializes in PHP/MySQL development, consulting and internet business management. He is also the founder of PC Mechanic (http://www.pcmech.com), a large website delivering do-it-yourself computer information to thousands of users every day.
Article Tags: directory [See Dictionary], file [See Dictionary], people [See Dictionary]
Got a question about this article? Ask the community!
Article published on October 07, 2005 at Isnare.com
 
Rate [Ratings: 4 / 5] [Votes: 1]

Hosting Considerations For Online Video
Submitted by: David Risley

Many webmasters (you may be one of them) have probably considered using video on their web site for promotional purposes...

Should You Use A Flash Introduction On Your Web Site?
Submitted by: David Risley

A “Flash intro”, better known by its infamous “skip-intro” name, is a bad web design technique that should be banned like asbestos...

Using Video To Draw Business On The Web
Submitted by: David Risley

It has been proven in the United States that there are more broadband internet users compared to dial-up...

Integrating A Website With Your Business
Submitted by: David Risley

It has been one of my continual themes when talking with clients about their websites that their site needs to serve their business...

Really Communicate To Your Website Visitors
Submitted by: David Risley

This article might be a bit different than you've come to expect from a webmaster-related article The reason is that, in my opinion, it is a facet of the internet many people don't really think about...

10 Tips For Web Success
Submitted by: David Risley

The webmaster's biggest job is to get their traffic up and keep customers/visitors coming back Building the site is one thing, but simply building and posting a website does not guarantee traffic...

Introduction To Ecommerce
Submitted by: David Risley

Many people new to websites and/or ecommerce are confused at the in and outs of ecommerce Even many people who are fairly adept at scripting can set up a store using some popular package such as OSCommerce and then are left stumped by the idea of making it work with a payment gateway to actually collect money and put it into their account...

Publishing A Newsletter
Submitted by: David Risley

Today, many websites offer a free newsletter Newsletters, from the receiving end, can be a great source for information that is delivered to your in-box...

Using Content Hubs To Promote
Submitted by: David Risley

We've all heard it before: content is king And it is true...

How To Hire A Web Developer
Submitted by: David Risley

Today, most businesses want a website Some already have one...

Making Money With A Content-Oriented Website
Submitted by: David Risley

Many websites out there have quite a bit of content, but are untapped as a resource for making money...

Outflow Equals Inflow
Submitted by: David Risley

There is a very simple formula which you should always remember when it comes to selling a product or service, or simply trying to get traffic to your website...

Basics Of Search Engine Optimisation (SEO)
Submitted by: Lijo George

What is SEO Search Engine Optimization is a step by step process in which a web site is optimized to the expectations of Search Engines...

Ebook - E For Environmental
Submitted by: Roberto Sedycias

The emphasis on going green is highlighted as writing books are one of the contributors for depleting natural resources...

Article Writer - Do You Need One?
Submitted by: Enzo F. Cesario

Content is king Your web presence needs content that your audience will be interested in, period...

How to Find Quality Web Directories
Submitted by: Jason Kay

When you promote your website one of the first things you will want to do is to submit your website to a number of different web directories...

Review of Mozy Online Storage
Submitted by: Jason Kay

Every year people just like you lose countless documents and important files because of the unforeseen, but with online storage companies such as Mozy, this scenario can be avoided forever...

You Can Still Make Good Money on Ebay
Submitted by: Mark Thomas Walters

The banning of the sale of digital products on eBay has led to many online marketers abandoning the use of eBay as one of their revenue streams...

Secrets to Using Social Bookmarking For Link Building
Submitted by: Blake Evans

Social bookmarking became popular as a tool to share your favorite websites with others on the internet...

What is Pagerank?
Submitted by: Blake Evans

The Internet is a vast expanse of space which contains matter on anything you can think of Due to the instantaneous nature of the Internet, anyone who has access to a computer and a phone line indulges in some browsing on various subjects...

Teleseminars - How to Use Them Effectively
Submitted by: Mark Thomas Walters

Teleseminars can be extremely beneficial to your online business because they give you a new way to reach new prospects as well as a new way to interact with your existing clients...

Internet Safety For Kids That Parents Should Know
Submitted by: Paul Phoenix

Internet is a believed to be a remarkable source through which school going kids can look for their desired information...

How to Network Using Twitter
Submitted by: Mark Thomas Walters

Twitter is the fastest growing social networking site on the Internet, and is a very popular subject within Internet marketing circles...

How to Get Your Website Indexed by Google in 15 Minutes
Submitted by: Jeffrey J Smith

Getting your website or blog indexed by Google is a good way to get your new online venture established and receive free traffic in the process...

Online Jobs - Cash Making Power Sites
Submitted by: Jack L. Smith

Legitimate Online Jobs - Do They Exist “Cash Making Power Sites” is just what the title suggest – it is a membership site that offers you not one but FIVE (yes, you heard it right) ready websites for you to start generating income...

Web Development - Get Deep Insights About Your Customers to Precisely Target Products and Services
Submitted by: Daljeet Sidhu

No business can be successful without a deep understanding of its customers This knowledge can help you to adapt your business style and advertising techniques to attract more customers and expand your client base...

Google's SafeSearch Helps Keep Kids Safer Online
Submitted by: Gregg Housh

The internet is a evolving community, home to everything from exotic recipes to ridiculous videos to books that are no longer in print...

Isnare.com Footer Divider

© 2004-2009. Isnare Free Articles - An Isnare Online Technologies Free Articles Project. All Rights Reserved.   Privacy Policy