HaLe Blog twitter
HaLe Blog Rss

.htpasswd protecting your phpMyAdmin installation (Debian)

Posted by lhe | Posted in Databases, General, Linux (Ubuntu), MySQL, PHP | Posted on 16-03-2010

3

So you got yourself a LAMP webserver and started hosting some sites on it. Now, for easy access to your databases, you opt to chose phpMyAdmin.

When installing phpMyAdmin on a Debian system via the synaptic manager (apt-get install phpmyadmin), the installation will be done in this folder

/usr/share/phpmyadmin

You will be able to access your phpMyAdmin via

http://www.mydomain.com/phpmyadmin

You will notice that you are asked for a username and password. This is great! It means that your database is protected…. but what if i want to protect it even more?
What if i would like to add some extra folder protection by using the good old .htpasswd technique?

Well, I looked around for a while but did not find any satisfying solutions. This meant I had to mess around a bit myself and after not too long, success! I had a phpMyAdmin installation where it would first use the .htpasswd protection before bringing me to the phpMyAdmin login page.

How did we do this?

1) create a .htpasswd file in the installation directory (cfr. supra). You can use handy .htpasswd generators like this one: http://www.htaccesstools.com/htpasswd-generator/

2) find and edit the phpMyAdmin apache2 config file:

/etc/apache2/conf.d/phpmyadmin.conf

3) add the necessary lines in the conf file to tell Apache2 it should use the .htpasswd file. Below you will find the before and after of the code.

Before:

# phpMyAdmin default Apache configuration
 
Alias /phpmyadmin /usr/share/phpmyadmin
 
		AllowOverride All
		Options Indexes FollowSymLinks
		DirectoryIndex index.php
 
		# Authorize for setup

After:

# phpMyAdmin default Apache configuration
 
Alias /phpmyadmin /usr/share/phpmyadmin
 
        AllowOverride All
        Options Indexes FollowSymLinks
        DirectoryIndex index.php
 
        AuthType Basic
        AuthName "HaLe MySQL"
        AuthUserFile /usr/share/phpmyadmin/.htpasswd
        Require valid-user
 
        # Authorize for setup

4) reload your Apache2

sudo /etc/init.d/apache2 reload

5) your phpMyAdmin is now .htpasswd protected!

Cheers
Lajfi

Sony Vaio VGN-FZ29VN meets Ubuntu Jaunty – the webcam

Posted by lhe | Posted in Leiv Hendrickx, Linux (Ubuntu) | Posted on 02-05-2009

2

ok, since switching to ubuntu on my laptop, i hadn’t been able to get my built in Ricoh webcam to work.

now 2 days ago, i upgraded to Ubuntu Jaunty and wanted to address this issue again. no luck at first site, but not wanting to give up, i started looking around and found the driver that did the trick!

ahixon / r5u87x / overview — bitbucket.org.

people who are using intrepid, should be able to find the answers here:

http://www.arakhne.org/ricoh/

well, it did the trick… meaning, the webcam is found now and i can play with it in “Cheese”… however, when trying to use it in aMsn or Skype, the image it renders is only a small portion of what it should show and it shows “double vision”. Since i suspect that it is not a 3D visualisation mode :-) , i am guessing there is still something off.
Actually, this was to be expected, since the driver r5u87x is still in the process of being fine tuned and bugs are not abnormal in this stage.

I will keep you posted if i should get it working.

VirtualBox – ubuntu host vista guest Host Interface Networking via Wireless

Posted by lhe | Posted in Leiv Hendrickx, Linux (Ubuntu) | Posted on 25-03-2009

4

Wireless Networking

Setting up a normal bridged network generally doesn’t work if you’re bridging from a wireless card to VirtualBox. A simple script that utilises the parprouted tool will allow your VM full access to the wireless network.

You will require parprouted to do this:

sudo apt-get install parprouted

Next, using your favorite text editor, create and edit the script, for example:

sudo nano /etc/network/if-up.d/vbox_network

Then, enter the script replacing $USER with your username or whoever you intend to run virtualbox as. Replace wlan0 with the name of your wireless interface. Use an available IP address on your network for tap0 I have used 192.168.1.100 in this case:

sysctl net.ipv4.ip_forward=1
VBoxTunctl -b -u $USER
ip link set tap0 up
ip addr add 192.168.1.100/24 dev tap0
parprouted wlan0 tap0

Finally, make sure the new file is executable by root:

sudo chmod 700 /etc/network/if-up.d/vbox_network

Now your networking script is installed, the virtual interface tap0 will be available on boot for VirtualBox. Rather than reboot, let’s just run the script now:

sudo /etc/network/if-up.d/vbox_network

The final thing to do is tell VirtualBox to use the new virtual device tap0. Open VirtualBox, highlight a VM and click settings. Now choose the network option and select Host Interface on the ‘attached to’ drop down menu. In the Interface Name text box, enter: tap0

Click ok and start your VM. The VM should now behave as though it was another physical machine on your network

For more information on the process up to this point, please visit Bridged Networking with VirtualBox on Linux Hosts

Using DHCP in the Guest VM

It was possible to get DHCP to work on the guest virtual machine. Instructions were taken from here. Because parprouted does not relay multicast, we need to use an additional helper daemon to manage this. I tried dhcp-helper and bcrelay, and had the most success with bcrelay.

Use it as follows:

sudo apt-get install bcrelay
sudo bcrelay -i tap0 -o wlan0

At this point, my /etc/network/if-up.d/vbox_network is as follows:

#/bin/sh
sysctl net.ipv4.ip_forward=1
VBoxTunctl -b -u jacob
ip link set tap0 up
ip addr add 192.168.1.200/32 dev tap0
parprouted tap0 wlan0
route add -net 192.168.1.0 netmask 255.255.255.0 tap0
bcrelay -i tap0 -o wlan0

via VirtualBox – Community Ubuntu Documentation.