Apache AuthBasic but excluding IP

Allow from IP without password prompt, and also allow from any address with password prompt Order deny,allow Deny from all AuthName "htaccess password prompt" AuthUserFile /web/askapache.com/.htpasswd AuthType Basic Require valid-user Allow from 172.17.10.1 Satisfy Any Sources http://www.askapache.com/htaccess/apache-authentication-in-htaccess.html  external link

2015-12-23 · 1 min · timor

Copy GTP partiotion table between disks

When configuring RAID it’s quite important to have the same partition tables on every disk. I’v done this many times on msdos partition tables like this: sfdisk -d /dev/sda | sfdisk /dev/sdb but it’s not working any more on GPT partition tables. Hopefully it still can be done but with different toolstack 😄 Install gdisk: apt-get install -y gdisk Then use sgdisk like this: sgdisk -R /dev/sd_dest /dev/sd_src sgdisk -G /dev/sd_dest First command will copy partition from /dev/sd_src to /dev/sd_dest. Second will randomize partition UUID’s - needed only if you want to use disks in same machine (this is my case). ...

2014-07-28 · 1 min · timor

Quickly setup SQL query logging on console in Django

There is need plugin for Django, named django-debug-toolbar but it needs some time to configure. So when I need simple way to debug SQL queries I use small hack. Add to your settings.py: LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'console': { 'level': 'DEBUG', 'class': 'logging.StreamHandler', } }, 'loggers': { 'django.db.backends': { 'handlers': ['console'], 'level': 'DEBUG', }, } } To get this working DEBUG option have to be set to True: ...

2014-05-28 · 1 min · timor

Changing default php.ini file for PHP-CLI on CentOS

On Debian in default installation you have different configuration files for PHP in Apache, FPM, CLI, etc. But on CentOS you have only one php.ini for all of them. In case I have, I need to have different configuration file for scripts running in CLI mode (more memory, etc). I could run it like this: php -c /etc/php-cli.ini script.php But this a little burdensome. So I do it like this: ...

2014-05-08 · 1 min · timor

Command to change root password

Everybody knows passwd command but it’s useless when you need to change ex. root password from command line without waiting for input. In such case oneliner below could help: echo "root:new_password" | chpasswd

2014-05-08 · 1 min · timor

Install Steam on Debian/Ubuntu

These are few steps to get Steam running on Ubuntu: wget -c media.steampowered.com/client/installer/steam.deb dpkg -i steam.deb apt-get install -f apt-get update Solutions for some issues Some time ago I needed 32 bit flash even on 64 bit system - I don’t need it currently but I’m living this as a tip. apt-get install adobe-flashplugin:i386 After Ubuntu upgrade I was unable to run Steam anymore - It shouted on me with strange “networking problem”. I have to clean Steam configuration with: ...

2014-04-22 · 1 min · timor

Rebuild yum/rpm database

When I was trying to update packages on one host I’ve stuck with yum hung on update. I run strace and see: strace -p 43734 Process 43734 attached - interrupt to quit futex(0x807c938, FUTEX_WAIT, 1, NULL <unfinished ...> Process 43734 detached It looks like yum database was corrupted, to repair this run: rm -f /var/lib/rpm/__db* rpm --rebuilddb yum clean all yum update Instead rm on db-files you could use gzip to have backup of these files. ...

2014-04-04 · 1 min · timor

Nagios - run checks as root with NRPE

I’ve few Nagios checks that require root privileges but running nrpe as root user is not acceptable. I prefer to use sudo for only these few commands. Run visudo and coment out this line: #Defaults requiretty This change is crucial to get scripts working. Then add at the end of file: %nrpe ALL=(ALL) NOPASSWD: /usr/lib64/nagios/plugins/ I’ve used nrpe group, but you have to add exactly group that your nrpe process uses. ...

2014-03-29 · 1 min · timor

WordPress - add meta tags: author, description, keywords, etc

After reading some SEO stuff I wanted to add some meta tags to my WordPress blog. I found this site: codex.wordpress.org/Meta_Tags_in_WordPress  external link . So WordPress thinks that it’s not necessary to have this meta tags any more… But I want it! 😃 Next funny thing is how they suggest to add meta tags: copy header.php - what about theme updates? ...

2014-03-27 · 1 min · timor

Mediawiki - recover admin rights

Let say you have MediaWiki installation but you lost admin credentials. If you have other account or if you could create one without any rights we’re in home 😉 We have few options to do this. Reset admin password We have to connect to database and use this SQL: UPDATE `user` SET user_password = CONCAT( SUBSTRING(user_password, 1, 3), SUBSTRING(MD5(user_name), 1, 8), ':', MD5(CONCAT(SUBSTRING(MD5(user_name), 1, 8), '-', MD5('new password')))) WHERE user_name = 'Admin'; Just replace Admin with your username and new password with your password. ...

2014-03-25 · 1 min · timor