Server Side PNG Optimisation with TimThumb
A little known feature of TimThumb is that is supports server side PNG optimisation.
Using the OptiPNG program (Available for Linux and Windows) TimThumb can losslessly compress PNGs on the fly.
Quick tests showed an original clients PNG came in at 671Kb, OptiPNG compressed that with no visible difference to 580Kb and nominal server load.
So lets go ahead and use it.
How to install the nslookup, host OR dig commands in Linux?
Sometimes you are unable to use the nslookup, host OR dig command on your Linux server and receives the following message
- -bash: nslookup: command not found -bash: host: command not found -bash: dig: command not found
The reason is the package required for the commands to work isn’t installed during the OS installation.
These are all DNS related commands useful to check the DNS report of a domain/IP.
You need to install the package bind-utils which offer the commands like nslookup, host, dig and others.
SSH to your server as root and execute
- yum install bind-utils
Done!
Disabling Core Dumps
I recently found a (cPanel) server was generating over 100Gb of core dumps every time a bad PHP script died or Apache died. Writing these generally useless (who actually debugs these on a live web server) to disk is a pointless waste of disk I/O, especially in a VPS environment.
Here is two methods of disabling core dumps;
Messing with time and date on Linux
Some Linux distros don't come with time synchronisation utilities, even though Windows has done it since Windows 2000.
Here's how I solved the issue on a basic CentOS install.
Key-Based SSH Logins With PuTTY
Following on from the previous SSH security ramblings, one of the most secure methods of security is public/private key-based authentication.
g up key based SSH logins for two reasons;
- They are more secure. You aren't prompted for a password which could be brute forced or sniffed via man in the middle attacks for example
- We're lazy. We don't want to type username/password combinations into each server.
SSH Security Ramblings
SSH - Secure Shell isn't that secure. If you're not using it behind a Layer 7 firewall or an enhanced security daemon like cPanel's cPHulk or even just the default config isn't secure.
What can you do?
[Snippet] Create a large file in Linux
Need to create a large file? For disk speed tests? Or space tests?
- dd if=/dev/zero of=your.big.file bs=1MB count=500
This will create a 500Mb file in your current directory called your.big.file
- 500+0 records in
- 500+0 records out
- 500000000 bytes (500 MB) copied, 4.08855 seconds, 122 MB/s
CIFS/SMBFS “mount error 13 = Permission denied”
Are you getting a rather generic "mount error 13 = Permission denied" when trying to mount Windows shares in Linux? I was.
Samba's been updated, keep up. You need to add the domain=XXX into your -o command, or text file for your credentials.
Using SCP to copy files between Linux servers
SCP? SCP is a method of securely transferring files between a local and a remote host or between two remote hosts, using the Secure Shell (SSH) protocol.
Sounds confusing?
Permanently mount a Windows share in Linux
Sick of manually mounting a Windows share on Linux with "mount" for it to drop off randomly? Or not really knowing if it is mounted or not?
Then make a permanent mount in fstab.


