Find DrewDahl on Facebook! Find DrewDahl on Twitter! View Andrew Dahl's Profile Drew's Blog

HowTo

.htaccess – No Auth for local access/Auth for outside access

by Drew Dahl on Dec.28, 2009, under HowTo, Linux

For this, we’ll throw an .htaccess file into the directory you don’t want anyone to access that’s served via apache. For this, we’ll also have to have the following set for the directory in the httpd.conf file:

AllowOverides AuthConfig

Here’s what the .htaccess file should look like (with a few modifications for location and network if you need):

AuthType Basic
AuthName "Remote Auth"
AuthUserFile /var/www/html/.htpasswd
Require valid-user

Order deny,allow
deny from all
allow from 192.168.0

Satisfy any

And then in the same directory, create the .htpasswd file by:

htpasswd -c .htpasswd username

Then when promptd, enter the password for that username. Make sure both files are owned by apache (or www-data if your webserver runs as such). Viola! It works.

(Note: To add more users that the htpasswd file, do the same command as above, without the -c)

Leave a Comment :, more...

Fixing The Error: DB_RUNRECOVERY: Fatal error, run database recovery

by Drew Dahl on Dec.27, 2009, under HowTo, Linux

If you get a message similar to this:

[username@localhost ~]$ sudo yum update
rpmdb: Thread/process 2402/139688794072832 failed: Thread died in Berkeley DB library
error: db4 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 -  (-30974)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed

You can fix it by running the following 3 commands:

[username@localhost ~]$ sudo rm -f /var/lib/rpm/__db*
[username@localhost ~]$ sudo db_verify /var/lib/rpm/Packages
[username@localhost ~]$ sudo rpm --rebuilddb
Leave a Comment :, more...

HowTo: Clone a VirtualBox HDD (.vdi)

by Drew Dahl on Dec.06, 2009, under HowTo, Linux, VirtualBox, Windows

Okay, this will be short and sweet. Here’s how you clone a VirtualBox HDD in Windows:

“C:\Program Files\Sun\VirtualBox\VBoxManage.exe” clonevdi “C:\Users\Andrew\.VirtualBox\HardDisks\Windows XP.vdi” “C:\Users\Andrew\.VirtualBox\HardDisks\Windows XP Clone.vdi”

and in Linux:

VBoxManage clonevdi /home/andrew/.VirtualBox/HardDisks/WindowsXP.vdi /home/andrew/.VirtualBox/HardDisks/WindowsXPClone.vdi

The basic form is “VBoxManage clonevdi sourcevdi destinationvdi”. Now you may ask, why clone a virtual machine’s hard drive? Well, if you want to back them up, this works for that. Or, if you want to duplicate that same virtual machine without having to do a second installation/activation.

Also to note, doing it this way will change the HDD’s UID, so you don’t get the error: “A hard disk with UUID {92c7da90-00f3-4bda-b338-57d24dad7f4b} or with the same properties (’/home/andrew/.VirtualBox/HardDisks/WindowsXP.vdi’) is already registered.”

Also, last thing to note… Instead of the directory “HardDrives”, yours may be “VDI”. I believe in older versions of VirtualBox it was VDI; however, these days it’s HardDrives.

1 Comment :, , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!