Remote Mirroring Using nc and dd

You can use the dd and nc commands for exact disk mirroring from one server to another. The following commands send data from Server1 to Server2: Server2# nc -l 12345 | dd of=/dev/sdb Server1# dd if=/dev/sda | nc server2 12345 Make sure that you issue Server2’s command first so that it’s listening on port 12345 when Server1 starts sending its data. Unless you’re sure that the disk is not being modified, it’s better to boot Server1 from a RescueCD or LiveCD to do the copy. »

Add syslog forwarding host to syslog-ng

$Header: /var/cvsroot/gentoo-x86/app-admin/syslog-ng/files/syslog-ng.conf.gentoo,v 1.7 2007/08/02 04:52:18 mrbones Exp $ # # Syslog-ng default configuration file for Gentoo Linux # contributed by Michael Sterrett options { chain_hostnames(off); sync(0); # The default action of syslog-ng 1.6.0 is to log a STATS line # to the file every 10 minutes. That's pretty ugly after a while. # Change it to every 12 hours so you get a nice daily update of # how many messages syslog-ng missed (0). »

Recursively delete .svn directories

Abstract This is a simple example of a unix command, which recursively deletes subversion .svn folders. Subversion is a well-spread open-source revision control application. Every copy of source code received from subversion repository has .svn folders, which store metadata. However, if you want to use or distribute source code for end-user consumption, these folders are not necessary. A simple svn export [repository] is suitable. Compatible Systems Linux, FreeBSD, Mac OS X, Cygwin Nearly any unix-compatible system with rm and find We use find command to find all . »

Setting up public key authentication over SSH

Generate key on local machine ssh-keygen -t rsa It will ask you for a password but you can leave it blank. Note you could also pick -t dsa if you prefer. Ensure that the remote server has a .ssh directory Make sure the server your connecting to has a .ssh directory in your home directory. If it doesn’t exist you can run the ssh-keygen command above, and it will create one with the correct permissions. »

Remove SSL key file pass-phrase

Sometimes you may want to remove the pass-phrase from your SSL key file. A specific use case is with a webserver (Apache, Cherokee, etc) where you do not want to be prompted to enter the pass-phrase each time the server starts. Requirements like these can get in the way of automated system procedures. Removing the password is simple: # root# openssl rsa -in -out Reference: »