Wednesday, 30 December 2009

Recover svn repository

It is normal that svn db get crashed because of permission issue. The following steps help to fix it.

chown svnuser:svngroup /path/to/repos
find /path/to/repos -type d -print0 -exec chmod 2775 {} \;
find /path/to/repos -type f -print0 -exec chmod 0664 {} \;
svnadmin recover /path/to/repos

Tuesday, 29 December 2009

Vi Editor magics

Adding line number to a file with vi

open the file with vi editor

:%!nl

of-course there are other ways to do it with vi :)

Add empty line after every line with vi

:%s/\v(.*\n){1}/&\r

Remove white space at the beginning of a line with vi

:%le

Sorting lines with vi

:sort u

Wednesday, 9 December 2009

script to convert openssh keys to tectia and tectia to openssh


#!/bin/bash
# Arun N S
menu="
Make your choice:
1. Openssh key to Tectia format
2. Tectia key to Openssh format
3. Exit"
while :
do
printf "%s\n: " "$menu"
read choice
case $choice in
"1") echo "Converting Openssh key to Tectia format"
echo "Enter key Path(full path):"
while read INPUT
do
ssh-keygen -e -f ${INPUT} > ${INPUT}.tectia
echo "OpenSSH format key is saved as: ${INPUT}.tectia"
exit 0
done
break;;
"2") echo "Converting Tectia key to Openssh format";
echo "Enter File Path(full path):"
while read INPUT
do
ssh-keygen -i -f ${INPUT} > ${INPUT}.openssh
echo "OpenSSH format key is saved as: ${INPUT}.openssh"
exit 0
done
break;;
"3") echo "3. Exit"
echo " Good Bye"
break;;
*) echo "Wrong Choice"
;;
esac
done


./arun

Monday, 7 December 2009

configure NSD as slave for BIND

To configure name server deamon as slave for bind:

# useradd -c "NSD" -d /home/nsd -s /sbin/nologin -u 1005 nsd

Download and install the latest version of nsd

# ./configure --prefix=/home/nsd --enable-dnssec --enable-tsig --with-user=nsd
# make
# make install


Edit config: /home/nsd/etc/nsd/nsd.conf
>>>
server:
ip-address:
hide-version: yes
debug-mode: no
ip4-only: no
ip6-only: no
database: "/home/nsd/var/db/nsd/nsd.db"
identity: ""
logfile: "/var/log/nsd.log"
server-count: 1
tcp-count: 10
pidfile: "/home/nsd/var/db/nsd/nsd.pid"
port: 53
statistics: 3600
chroot: "/home/nsd/etc/nsd"
username: nsd
zonesdir: "/home/nsd/etc/nsd"
difffile: "/home/nsd/var/db/nsd/ixfr.db"
xfrdfile: "/home/nsd/var/db/nsd/xfrd.state"
xfrd-reload-timeout: 10


Add key and zone file details:

Start NSD with:
/home/nsd/sbin/nsdc start

to create zone files:
/home/nsd/sbin/nsdc patch

./arun

Changing subversion (svn) url

To change the svn url to another one:


$ svn switch --relocate file:///tmp/repos file:///tmp/newlocation .
or if it is with ssh
$ svn switch --relocate svn+ssh://username@svnurl/path/to/svn/ svn+ssh://new_username@new_svnurl/path/to/svn/

Wednesday, 2 December 2009

resetting mac os x password

To reset the password on MAC OS X,
- hold down apple+s key while booting the machine, this will take you to the single user mode
- Mount the file system using , # mount -uw /
- Enter the passwd command with username , #passwd
- reboot the machine

Anyway this will not reset the key chain password, to reset the key chain password:
1. Open Keychain Access, which is in the Utilities folder within the Applications folder.
2. From the Keychain Access menu, choose Preferences.
3. Click Reset My Keychain, which is under the General pane.
4. Authenticate with your account login password.
5. Quit Keychain Access.
6. Restart your computer.
ref : http://support.apple.com/kb/TS1544

./arun