Archive for the ‘Linux’ Category

Configuring MySQL over SSL for client connections

Useful for setting up encrypted connections between client and server.  Parts of this can be substituted if you wished to get a certificate issued from a trusted CA. 1. Check that SSL has been compiled in MySQL on the server: SHOW VARIABLES LIKE ‘have_openssl’; or mysql –ssl –help If it says disabled or yes then […]

Linux ip useful commands

ip -4 -o addr – nicely formatted list of IPv4 addresses on machine ip link show – shows the available interfaces on machine

Bulk DNS Query in Plesk

I put this command together to grab DNS information relating to all of the domains hosted on a Plesk server.  Useful if your migrating to a new server and need to know where to update the DNS zones.  This checks the nameservers but can easily be substituted with A or MX: for domain in $(mysql […]

Spamassassin 2010 bug

A bit of an oversight – old versions of Spamassassin have an inbuilt rule to block emails with a future date.  Not a bad idea really, but the rule starts blocking things from 2010!  The rule should be fixed in newer versions, however Plesk for example uses a fairly old version. You can edit the […]

qmail adds number to recipient header

qmail sometimes adds a number to the recipient header when delivering mail locally, so for example, may become  This isn’t such a problem when mail is just being used locally, but if your using a POP connector to download mail to an Exchange server for example it will cause issues with it getting […]

Plesk 9 – Horde webmail configuration disappears

Strangely all of the webmail conf files for horde disappeared in my Plesk 9 setup. This regenerated them: for domain in `mysql -uadmin -p$(cat /etc/psa/.psa.shadow ) -Dpsa -e’select name from domains d, dom_param dp where and dp.param=”webmail” and dp.val=”horde”;’`; do /usr/local/psa/admin/bin/webmailmng –set-default –vhost-name=$domain –name=horde ; done Update: seems to be a result of hotfix […]

Plesk 9 – Migration Manager set source directory

For some bizarre reason The Plesk 9 migration manager has taken away the functionality to specify the partition used on the source server.  Not very handy if you have partitions running low on disk space.  I’ve found two solutions that seem to work: On the target server edit /usr/local/psa/admin/share/migration-handler/ Modify the following line and update […]

Adding date/time to BASH history

Useful if you have several admins on a server, so you can figure out who did what when. Edit /etc/bashrc  and add: export HISTTIMEFORMAT=”%h/%d – %H:%M:%S “

crontab format

1 2 3 4 5 /path/to/command arg1 arg2 Where: * 1: Minute (0-59) * 2: Hours (0-23) * 3: Day (0-31) * 4: Month (0-12 [12 == December]) * 5: Day of the week(0-7 [7 or 0 == sunday]) * /path/to/command – Script or command name to schedule crontab -e = edit crontab -l = […]

chown a symlink

Not sure why I always forget this, but to chown or chmod a symbolic link rather than its target use the -h (no-dereference) flag: chown -h new_user symbolic_link_name