1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-06-28 16:48:00 +02:00
blog/_src/_posts/2008-02-26-how-to-quickly-generate-encrypted-logins-on-a-mac-for-htaccess-protected-sites.markdown

34 lines
1.9 KiB
Markdown

---
author: Matthias Kretschmann
comments: true
date: 2008-02-26 23:24:17+00:00
layout: post
slug: how-to-quickly-generate-encrypted-logins-on-a-mac-for-htaccess-protected-sites
title: How to quickly generate encrypted .htpasswd passwords
wordpress_id: 12
categories:
- design
tags:
- tutorial
---
As you may know you can easily password protect your website or parts of it using an htaccess file with special instructions on an [Apache](http://www.apache.org/)-based server. For using this method you just have to put a file named .htaccess (which includes the instructions for the webserver) and a file named .htpasswd (which includes the login-accounts) in the directory you want to have password protected. But you have to encrypt the passwords of the login data for yourself, which is a quick task on a Mac.
<!-- more -->
I won't go into detail what exactly is needed in your .htaccess-file, since it often depends on your hosting provider which instructions are allowed. If you are new to all this stuff and want to password protect your website or parts of it, have a look in the part ["Password Protection"](http://www.javascriptkit.com/howto/htaccess3.shtml) of the [Comprehensive guide to .htaccess written by Feyd](http://www.javascriptkit.com/howto/htaccess.shtml).
The login data, in detail just the password is stored encrypted in the .htpasswd-file but you have to encrypt it before writing it in this file. On a Mac you can benefit from the underlying [Unix](http://www.apple.com/macosx/technology/unix.html)-technology for quickly generating your login accounts using the commandline utility htpasswd.
Just open Terminal application and type in the following code and replace username and password with your desired data:
<code>htpasswd -nb username password</code>
and press enter. Terminal should output a new line containing your login data with an encrypted password. Just paste it in your .htpasswd-file and you're done.
It's that easy.