Wednesday, April 09, 2014

Friday, February 07, 2014

remove a line from a file

sed -i '22d' /root/.ssh/known_hosts


or better is to do ssh-keygen  -R hostname/IP

linux change root disk grub-install

redetect disks by grub-install in case dd ing 446 bytes from one disk to the other did not work, /boot/grub/devices.map needs to be fixed

Wednesday, February 05, 2014

perl command line arguments

#!/usr/bin/perl -w

use strict;
use Getopt::Long;
use utils qw( &usage );
my($host,$port,$user,$password,$file,$opt_w,$opt_c) = ("",22,"","","","","","","","");

Getopt::Long::Configure('bundling', 'no_ignore_case');
GetOptions
("H|host=s"     => \$host,
 "p|port=s"     => \$port,
 "U|user=s"     => \$user,
 "P|password=s" => \$password,
 "F|file=s"     => \$file,
 "w|warning=s"  => \$opt_w,
 "c|critical=s" => \$opt_c,
 );


($host) ||  usage("Host not specified\n");
($user) ||  usage("SFTP Username not specified\n");
($password) || usage("SFTP password not specified\n");
($file) ||  usage("File to upload and download not specified\n");
($opt_w) || usage("Warning threshold not specified\n");
($opt_c) || usage("Critical threshold not specified\n");

Tuesday, February 04, 2014

rvm install ruby specific version

\curl -k -sSL https://get.rvm.io | bash -s stable --ruby=1.9.3-p362

Monday, February 03, 2014

replace root with lvm

In rescue mode::

KER=`ls /lib/modules` #if single kernel
initrd -v -f /boot/initrd-$KER.img $KER

DAAA  :::: make sure you do not have rd_NO_LVM in the options passed to vmlinuz


Friday, December 20, 2013

linux remove sata disk

echo 1 > /sys/block/(whatever)/device/delete

thanks to http://unix.stackexchange.com/questions/43413/how-can-i-safely-remove-a-sata-disk-from-a-running-system

Friday, October 25, 2013

centos enable LVM for root disk

1. do vgchange -a y /dev/vg1/lv_root

this enables you to see the logical volume from the rescue/gparted disk

1. do mkinitrd -f /boot/initrd-2.6.xxxxxx 2.6.xxxxxxx

Tuesday, October 01, 2013

extend an lvm with a file on another partition

if resizing another lvm and file system is not an option (time consuming) a temp solution will be

dd if=/dev/zero of=/var/disk1_2.dsk bs=1M count=100

losetup /dev/loop0 /var/disk1_2.dsk

pvcreate /dev/loop0

vgextend /dev/VG1/lv_disk1

lvextend -L+100M /dev/VG1/lv_disk1

vim /etc/rc.local
losetup /dev/loop0 /var/disk1_2.dsk 

Monday, September 16, 2013

awk gsub for regular expression modification of strings

Use gsub like this

ping -c1 10.10.27.5 > /dev/null;arp 10.10.27.5 | awk '/ether/ {gsub(/:/,"",$3);print $3}'

awk print last line

awk 'END{print}'

Thursday, June 27, 2013

remove unkown device from VG

add a new disk and assign the missing uuid to it

pvcreate --uuid 56ogEk-OzLS-cKBc-z9vJ-kP65-DUBI-hwZPSu /dev/sdc1

then remove it from the VG and PVs

Thursday, June 20, 2013

bash read file line by line

cat myfile.lst | while read field1 field2;do echo $field1 $field2;done

comm - join like utility on linux

Compare sorted files FILE1 and FILE2 line by line.

       With  no  options,  produce  three-column  output.  Column one contains lines unique to FILE1, column two contains lines unique to FILE2, and column
       three contains lines common to both files.

Wednesday, June 05, 2013

ssh disable host authenticity checking

ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l user 10.10.1.70

thanks to http://linuxcommando.blogspot.com/2008/10/how-to-disable-ssh-host-key-checking.html

Monday, April 08, 2013

Friday, April 05, 2013

basic nagios bash service check

#!/bin/bash

CMD=`some command with a numerical output`

# Sanity check
if [ $# -ne 4 ]; then
        echo "Usage: $0 -w WARNING -c CRITICAL"
        exit
fi


while getopts ":w:c:" optname
  do
    case "$optname" in
      "w")
        WARNING=$OPTARG
        ;;
      "c")
        CRITICAL=$OPTARG
        ;;
      "?")
        echo -e "Unknown option $OPTARG\nUsage: $0 -w WARNING -c CRITICAL"
        ;;
      ":")
        echo "No argument value for option $OPTARG"
        ;;
      *)
      # Should not occur
        echo "Unknown error while processing options"
        ;;
    esac
  done

E_SUCCESS="0"
E_WARNING="1"
E_CRITICAL="2"
E_UNKNOWN="3"

if [ "$CMD" -gt "$CRITICAL" ]; then
        echo -n "CRITICAL"
        RETCODE=$E_CRITICAL
elif [ "$CMD" -gt "$WARNING" ];then
        echo -n "WARNING"
        RETCODE=$E_WARNING
else
        echo -n "OK"
        RETCODE=$E_SUCCESS
fi

echo "|RESULT=$CMD"
exit $RETCODE

Thursday, April 04, 2013

postgres add user

1. useradd user1

2. vi /var/lib/pgsql/data/pg_hba.conf

#add the user the user ip address with authentication like this

host    all         all         10.1.19.12/32           md5

3. su - postgres

createuser user1

3. last step is to add the user to the db

alter user user1 with encrypted password 'XXXXXX';

4. grant all on tablex to user1 

or run these on the db
select 'grant all on '||schemaname||'.'||tablename||' to bar;' from pg_tables where schemaname in ('public') order by schemaname, tablename;

Wednesday, March 13, 2013

remove physical volume from logical

1. add another disk to the system

2.   
pvcreate /dev/sdb1
vgextend /dev/VolGroup00 /dev/sdb1

3. pvmove /dev/sda4 /dev/sdb1

4. vgreduce /dev/VolGroup00 /dev/sda4


** REMEMBER TO ADD EXTENDED PARTITIONS to the system not to have to go through this again YOU ASS

Monday, February 25, 2013

list files in the past x minutes

find . -maxdepth 1 -mmin -1000 -ls

**BE CAREFUL not to forget the dash before the interval value

postgres date and time query

Postgres saves times in UTC to do a query using the server timezone use the below
select caller_aor,callee_aor,start_time AT TIME ZONE 'UTC' from cdrs where  and start_time > '2013-02-22 00:00:00' AT TIME ZONE 'UTC';

Thursday, January 31, 2013

mysql enable timezone conversion by zoneinfo database timezone labels

If convert_tz(now(),'UTC','US/Pacific') produced null do a

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

Monday, January 28, 2013

postgres grant to all tables

select 'grant all on '||schemaname||'.'||tablename||' to bar;' from pg_tables where schemaname in ('baz', 'quux') order by schemaname, tablename;

taken from: http://bensbrain.blogspot.com/2004/08/postgres-grant-on-all-tables-in.html

Thursday, November 15, 2012

regular expression to match xml attribute values

Lead Id="xxxx" and AgentId="yyyyy" are two attributes in an XML file (Lead Id must be the first)
[\s\S]*Lead Id="([^"]*)"[\S\s]*AgentId="([^"]*)"

Tuesday, October 30, 2012

using ngrep to view sip messages


ngrep -W byline -d eth0 port 5060
Just the invites:
ngrep -W byline -d eth0 INVITE
thanks to
http://www.jonathanmanning.com/2009/11/17/how-to-sip-capture-using-ngrep-debug-sip-packets/

Thursday, October 11, 2012

bash script cgi post and get process web form input

Thanks to Thanks to http://oinkzwurgl.org/bash_cgi

#!/bin/bash
echo -e "Content-type: text/html\n\n"
cat <<EOF
<html>
<body>
<form action="?foo=1234" method="POST" enctype="application/x-www-form-urlencoded">
bar: <input type="text" name="bar"><br/>
foobar: <textarea name="foobar"></textarea></br>
<input type="submit">
</form>
EOF


# (internal) routine to store POST data
function cgi_get_POST_vars()
{
    # check content type
    # FIXME: not sure if we could handle uploads with this..
    [ "${CONTENT_TYPE}" != "application/x-www-form-urlencoded" ] && \
    echo "bash.cgi warning: you should probably use MIME type "\
         "application/x-www-form-urlencoded!" 1>&2
    # save POST variables (only first time this is called)
    [ -z "$QUERY_STRING_POST" \
      -a "$REQUEST_METHOD" = "POST" -a ! -z "$CONTENT_LENGTH" ] && \
        read -n $CONTENT_LENGTH QUERY_STRING_POST
    # prevent shell execution
    local t
    t=${QUERY_STRING_POST//%60//} # %60 = `
    t=${t//\`//}
    t=${t//\$(//}
    QUERY_STRING_POST=${t}
    return
}

# (internal) routine to decode urlencoded strings
function cgi_decodevar()
{
    [ $# -ne 1 ] && return
    local v t h
    # replace all + with whitespace and append %%
    t="${1//+/ }%%"
    while [ ${#t} -gt 0 -a "${t}" != "%" ]; do
    v="${v}${t%%\%*}" # digest up to the first %
    t="${t#*%}"       # remove digested part
    # decode if there is anything to decode and if not at end of string
    if [ ${#t} -gt 0 -a "${t}" != "%" ]; then
        h=${t:0:2} # save first two chars
        t="${t:2}" # remove these
        v="${v}"`echo -e \\\\x${h}` # convert hex to special char
    fi
    done
    # return decoded string
    echo "${v}"
    return
}

# routine to get variables from http requests
# usage: cgi_getvars method varname1 [.. varnameN]
# method is either GET or POST or BOTH
# the magic varible name ALL gets everything
function cgi_getvars()
{
    [ $# -lt 2 ] && return
    local q p k v s
    # prevent shell execution
    t=${QUERY_STRING//%60//} # %60 = `
    t=${t//\`//}
    t=${t//\$(//}
    QUERY_STRING=${t}
    # get query
    case $1 in
    GET)
        [ ! -z "${QUERY_STRING}" ] && q="${QUERY_STRING}&"
        ;;
    POST)
        cgi_get_POST_vars
        [ ! -z "${QUERY_STRING_POST}" ] && q="${QUERY_STRING_POST}&"
        ;;
    BOTH)
        [ ! -z "${QUERY_STRING}" ] && q="${QUERY_STRING}&"
        cgi_get_POST_vars
        [ ! -z "${QUERY_STRING_POST}" ] && q="${q}${QUERY_STRING_POST}&"
        ;;
    esac
    shift
    s=" $* "
    # parse the query data
    while [ ! -z "$q" ]; do
    p="${q%%&*}"  # get first part of query string
    k="${p%%=*}"  # get the key (variable name) from it
    v="${p#*=}"   # get the value from it
    q="${q#$p&*}" # strip first part from query string
    # decode and evaluate var if requested
    [ "$1" = "ALL" -o "${s/ $k /}" != "$s" ] && \
        eval "$k=\"`cgi_decodevar \"$v\"`\""
    done
    return
}



# register all GET and POST variables
cgi_getvars BOTH ALL

echo "<pre>foo=$foo</pre>"
echo "<pre>bar=$bar</pre>"
echo "<pre>foobar=$foobar</pre>"

cat <<EOF
</body>
</html>
EOF

Monday, October 08, 2012

run command from within awk

cat ips.txt | awk '{system("ping -c 1 "$1}'

Thursday, October 04, 2012

Thursday, September 06, 2012

nagios check_snmp does not work but snmpget does

check_snmp of nagios uses version 1 of SNMP automatically, to force version 2c for the devices that do not support it add a -P 2c to the switches.

Also to check what snmpget is executed by the check_snmp simply run it with -v switch

snmpget works but nagios check_snmp does not

run your check_snmp with -v so it displays what exact snmpget it is calling

Thursday, August 16, 2012

SIPXECS 404

On SipXecs when you get a 404 not found, it does not only mean the user was not found, it means that the registrations string was not matched, so it is quite possible that the server aliases are not put under the Domain so strings do not match


XXXX@sip1.sip.company.com needs to match
add sip1.sip.company.com under Domain =>Alias

Tuesday, August 14, 2012

add functionality to snmpd to report the output of a script

Add functionality to snmpd to report the output of a script

1. Create the script

cat /usr/local/check_reg.sh

#!/bin/bash
grep uri /var/sipxdata/sipdb/registration.xml | wc -l

2. Add it to snmpd.conf

cat /etc/snmp/snmpd.conf
...
extend check_reg /usr/local/check_reg.sh
....

3. now snmpwalk it
snmpwalk -v2c -c pub localhost NET-SNMP-AGENT-MIB::nsExtensions


Monday, August 13, 2012

listen to g722 RTP streams in a PCAP file

The easiest way to listen to g722 RTP streams in a pcap file is to
1. Open the pcap file and just save the RTP packets (remove the RTCP using the filter rtp.ssrc!=0xBADBADBA)
2. Upload the file in http://pcap2wav.xplico.org/ and download the wav files

Friday, June 15, 2012

linux find executable files


find . -type f -perm -+x

Sunday, May 20, 2012

Windows VPN Connection with automatic routes added without default gateway option

type c:\windows\vpn.bat

@echo off
rasdial VPN_CONNECTION_NAME USERNAME PASSWORD
for /f "tokens=15 delims= " %%A in ('ipconfig ^| find "192.168.200"') do @set GW=%%A
route add 192.168.45.0 mask 255.255.255.0 %GW%

Wednesday, May 02, 2012

SRV records for service redudnacy

You can use SRV records just like MX records for other services redundancy for services other than mail

Friday, April 06, 2012

rescue missing vmdk disk

recreate vmdk from *-flat.vmdk file
vmkfstool -c $SIZE -a lsilogic -d thin temp.vmdk
edit the temp file and replace temp-flat with your own flat file name
thanks to http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1002511

Wednesday, March 07, 2012

windows variables

use %%A within batch files and %A outside in the shell

automatic windows VPN/PPP dial using rasdial

rasdial %CONNECTION_NAME% username password

windows awk using for /f command

example:
C:\Documents and Settings\Ali>for /f "tokens=15 delims= " %A in ('ipconfig ^| find "192.168.7"') do @set GW=%A

windows extract ip address from command line

for /f "tokens=15 delims= " %A in ('ipconfig ^| find "192.168.7"') do @set GW=%A

Wednesday, February 29, 2012

Wednesday, February 22, 2012

Windows automatic dial VPN PPTP connection

rasdial CONNECTION_NAME USERNAME PASSWORD

Thursday, January 19, 2012

veeam scp problem windows 64 bit (x64)

download courflags from
http://www.virtualvcp.com/content/view/26/1/
then do a
courflags "C:\Program Files (x86)\Veeam\Veeam Backup and FastSCP\VeeamShell.exe" /32BIT+"

big thanks to
http://www.everything-virtual.com/?p=279

Monday, January 16, 2012

vmware server 2 remote client problem on linux

goto somewhere like the below

cd ~/.mozilla/firefox/r1ejwkml.default/extensions/VMwareVMRC@vmware.com/plugins

and run
./vmware-vmrc -h "localhost:8333"





Saturday, January 14, 2012

dd progress status

while [ `pgrep ^dd` ]; do kill -USR1 `pgrep ^dd`;sleep 1;done

Tuesday, January 10, 2012

ssh disable slow dns

in /etc/ssh/sshd_config
UseDNS no

Friday, December 16, 2011

rsync vs scp

Remember not to try to rsync like scp, DO NOT SPECIFY PATH, instead look at the [] sections in rsyncd.conf called MODULES and use the below syntax

rsync * 192.168.1.1::MODULE_NAME

REMEMBER YOU ASS

Wednesday, November 30, 2011

usb dongle to vmware esx guest

use a network USB hub or a USB server software like kernelpro.com

Sunday, November 06, 2011

MS SQL Server update based on two tables

update r
set pass = x.pass
from InternetUser r inner join InternetUser x
on r.id = x.id
where r.pass = 'kjfkd9wjj2390eds9d';

Friday, November 04, 2011

simple socks server

simple socks server using ssh

ssh -f -N -D 0.0.0.0:1080 localhost

Wednesday, November 02, 2011

windows server domain policy

Simple thing took sooo much of my time
to change domain group policies that effect all domain machines change the Domain Security Policy under Administrative Tools not Local Group Policy by adding it under an mmc

Also to see which group policies are in effect in the domain look at gpresult /v >gposettings.txt

Tuesday, July 19, 2011

resize disk vmware vsphere


resize the disk from vsphere client,
in linux client do a

echo 1 > /sys/bus/scsi/devices/0\:0\:0\:0/rescan

# replace 0\:0\:0\:0 with your own disk scsi id and then

resize2fs /dev/sda

PS: In case a new disk was added to the SCSI bus you need to

echo "- - -" > /sys/class/scsi_host/host0/scan

Saturday, July 16, 2011

shrink vmware vmdk virtual disk ESXi 4

use vmware converter to create a copy of the virtual machine which needs to be powered ON for the converter to see the actual data, resize the disks also choose advanced thin for the disk type and have fun, remove the old machine later.

vmware converter helper server error

When vmware can not find the vmware helper server for conversion make sure that
1. conveter and esx server and the machine being converted are on the same lan (check the vlan property before converting)
2. the vlan on which the helper and these other machines are does have a DHCP server on, otherwise configure static IP for the helper

Tuesday, June 28, 2011

use listagg to convert columns into rows

SELECT id, LISTAGG(str, ',') WITHIN GROUP (ORDER BY str) AS name
FROM new_test
GROUP BY id;

gives you
1 a,b,c
2 d,e
3 f

from
1 a
1 b
1 c
2 d
2 e
3 f

Tuesday, June 21, 2011

previous not null values of a field in oracle

select lastprice, lag(lastprice ignore nulls,1) over (order by statdate) from daily_statistics

automount a specific directory with autofs

this is what we do
first umount your directory then mount the location you want to another directory and later create a symbolic link with the name you need

umount /usr/local/apache-tomcat-6.0.26/information-repository

rmdir /usr/local/apache-tomcat-6.0.26/information-repository

vi /etc/auto/master
/usr/local/mounts /etc/auto.nfs

vi /etc/auto.nfs
m_29 -fstype=nfs,rw 192.168.0.29:/u01/information-repository

mkdir /usr/local/mounts/m_29

ln -s /usr/local/mounts/m_29 /usr/local/apache-tomcat-6.0.26/information-repository

Friday, June 17, 2011

mount with UUID

get a blkid to find the UUID of the device you are after then in /etc/fstab do like this:
UUID=41c22818-fbad-4da6-8196-c816df0b7aa8 /disk1 ext3 defaults 0 0

Thursday, June 16, 2011

split the internet into 8 parts :)

1.0.0.0/255.0.0.0
2.0.0.0/254.0.0.0
4.0.0.0/252.0.0.0
8.0.0.0/248.0.0.0
16.0.0.0/240.0.0.0
32.0.0.0/224.0.0.0
64.0.0.0/192.0.0.0
128.0.0.0/128.0.0.0

Saturday, June 11, 2011

fortinet SSL VPN client automatic startup

download the client from here:
http://internal.enterprisecomponent.com/download/FortiClientSSLVPN/forticlientsslvpn_linux_4.0.2010.tar.gz

start the client and in advanced check save password and persistent connection

add the vpn client to the startup of a vnc server in ~/.vnc/xstartup

start the vncserver automatically by editing /etc/sysconfig/vncserver

and chkconifg vncserver on

Thursday, June 09, 2011

cacti add simple graph for a value from script

read this babe:
http://www.cacti.net/downloads/docs/html/how_to.html

cacti monitor link

1. add the ip address you want to monitor as a new device
2. Add the "Unix-Ping Latency" graph template to it.
3. Add a new graph of the above template to your device.

BIG thanks to: http://www.networknet.nl/apps/wp/archives/367

Monday, June 06, 2011

Linux add and load MIB

1. Copy the file the same place other MIB files are
2. add mibs +DEVICE_MIB to /etc/snmp/snmp.conf
3. snmpwalk -v2c -c public IP_ADDR enterprise

Sunday, May 29, 2011

linux force reboot or shutdown

Force Reboot :
echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger

If you want to force shutdown machine try this.
echo 1 > /proc/sys/kernel/sysrq
echo o > /proc/sysrq-trigger

Thanks to http://linax.wordpress.com/2009/02/16/linux-force-reboot-and-shutdown/

Wednesday, May 25, 2011

linux create logical volume

pvcreate /dev/sdb1
vgcreate VolGroup01 /dev/sdb1
lvcreate -L953G -n LogVol00 VolGroup01
parted -l

add iscsi target and initiator in CentOS Linux

----------------- Target (Server) ----------------
#> vi /etc/tgt/targets.conf

<target iqn.2011-04.com.storage2.volgroup01.logvol00>
backing-store /dev/VolGroup01/LogVol00
</target>

#> service tgtd restart

; Take care of iptables

-----------Initiator (Client) -------------
#> iscsiadm -m discovery -t st -p 192.168.2.140
#> iscsiadm -m node
#> chkconfig iscsi on
#> service iscsi start


Sunday, May 22, 2011

linux discover and add new disk without reboot dynamically

To Discover and add new disk to a linux machine without having to reboot the server (e.g when virtual disk is added to a machine online) do the below:

ls /sys/class/scsi_host

#output is host0
#new rescan the scsi bus
echo "- - -" > /sys/class/scsi_host/host0/scan

#now you can see the new disk
fdisk -l

# add the new disk to the lvm if you want

Monday, May 16, 2011

vmware server 2 virtual console does not load

To solve the problem
find and run ./vmware-vmrc -h server:8333 -M "VM_ID"
to find "VM_ID" goto vmware webui and generate a shortcut on dekstop

Tuesday, May 10, 2011

ESXi scp

In ESXi to do scp using pscp simply do scp -scp to avoid doing sftp

Wednesday, May 04, 2011

Mikrotik DMZ

To put and IP address in DMZ
simple create a destination nat from the public IP to private without specifying anything else

Wednesday, April 20, 2011

get my oracle support (MOS) and metalink access cheap

Buy either
Oracle Load Testing Accelerator for Oracle E-Business Suite
Oracle Load Testing Accelerator for Siebel

Tuesday, April 19, 2011

linux bandwidth control

1. behind a router (easily done in mikrotik with queues)
2. using tc with iptables mangle
3. using redirection of traffic via squid proxy

Monday, February 28, 2011

MSM LSI MEGARAID

Install the latest MSM Megaraid manager regardless of whatever version actually belongs to the storage card on LSI website

Wednesday, January 19, 2011

Monday, January 10, 2011

openfiler scsi target not found in ESX 4.1

just edit /etc/initiators.deny and comment "ALL"

Sunday, January 09, 2011

resize LVM by adding new disk to lvm

    
fdisk /dev/sdb
mkfs -t ext3 -c /dev/sdb1
pvcreate /dev/sdb1
vgextend VolGroup00 /dev/sdb1
lvextend -L+1G /dev/VolGroup00/LogVol00 ;for adding one more GB to Logical Volume LogVol01
resize2fs /dev/VolGroup00/LogVol00


Thanks to http://sujithemmanuel.blogspot.com/2007/04/how-to-add-disk-to-lvm.html

amplify sound volume of a video file

To amplify - increase sound volume of - a video file do

ffmpeg -i myvideo.avi -vcodec copy -vol 5000 myvideo_louder.avi

thanks to http://superuser.com/questions/13552/how-to-amplify-the-audio-in-a-video-file

Thursday, January 06, 2011

VMWARE ESX 4.1 boot from ISO does not work

Remember to check the box which says "Connected", the damn thing took soooo much of my time.

Monday, December 20, 2010

Tuesday, December 07, 2010

linux detach screen

to exit a session created by screen command without stopping what is going on in the session do a
CTRL+a then d

Friday, November 19, 2010

awk dmidecode output

dmidecode | awk 'BEGIN {RS = "\n\n"} /System Information/'
thanks to http://aixhealthcheck.com/index.php?id=246

Wednesday, October 27, 2010

duplicate lines in vim

yy (copy) or dd (cut) a line and then do a p (paste)

NOHUP

start applications with nohup so they will not be closed once the terminal session is closed.

Tuesday, October 26, 2010

copy and backup

find /tmp/test/ -name '*.csv' -exec cp --backup=numbered {} /tmp/test2/ \;

if a file exists in the destination cp will create a copy first like filename.~1~

Thanks to RAMIN the RAMPALO

Sunday, October 24, 2010

monitoring software

the best product I have seen yet: http://www.manageengine.com

Saturday, October 23, 2010

linux iptables SNAT

you do not have to have the ip address of a machine behind iptables set on the gateway machine before you can SNAT with the ipaddress of the machine behind the firewall. In other words you can keep your valid ip address on the machine behind the gateway and still ask your gateway to SNAT with that IP.

iphone phonebook problem

Caller ID format Fix

Wednesday, October 20, 2010

Linux Directory Entry condition

to be able to enter a directory it needs to be +x enabled, you ass!

Visio add text to shape with yellow dot

In detail, it goes something like this:

1. Create or select a shape (duh!)
2. Open the ShapeSheet via Window > Show ShapeSheet
Go to: Insert > Section and check Controls and Text Transform (if it isn’t grayed out)
You should now see both the Controls section and the Text Transform section in the ShapeSheet.
3. In the Text Transform section, set the TxtPin cells as follows:
TxtPinX = Controls.Row_1.X
TxtPinY = Controls.Row_1.Y
4. In the drawing window, reposition the control handle to a suitable default position. The text should follow along!

Taken from: http://www.visguy.com/2009/05/06/top-twelve-text-tips/

Wednesday, August 25, 2010

rsync from windows to linux

1.
vi /etc/xinetd.d/rsync
set disabled = no

2.
cat /etc/rsyncd.conf
max connections = 2
log file = /var/log/rsync.log
timeout = 300

[pub]
comment = Random things available for download
path = /home/oracle/work
read only = yes
list = yes
uid = oracle
gid = oinstall
auth users = pub
secrets file = /etc/rsyncd.secrets

[share2]
comment = t2
path = /home/oracle/work2
read only = yes
list = yes
uid = oracle
gid = oinstall
auth users = pub2
secrets file = /etc/rsyncd.secrets

3.
cat /etc/rsyncd.secrets
pub:pub
pub2:pub2

4.
chmod 600 /etc/rsyncd.secrets

5.
download http://www.brentnorris.net/rsync.zip

6. rsync like this:
rsync -aPv rsync://pub@192.168.0.213/pub .

Saturday, August 14, 2010

Windows XP enable AHCI mode after IDE Install

1. download the corresponding Intel Matrix Storage driver for your Motherboard (ICHX)

2. c:\iata_enu.exe -a

3. copy c:\Program Files\Intel\Intel Matrix Storage Manager\IaStor.sys c:\windows\system32\drivers

4. find the corresponding AHCI.reg file from the internet for your motherboard (ICHX)

5. load the reg file into you registry

6. reboot and enable AHCI mode

7. When windows started cancel automatic hard disk detection and install Intel Matrix Storage and reboot

taken from http://forums.hexus.net/hexus-hardware/112584-how-enable-ahci-raid-mode-without-reinstalling-windows-p35-ich9-ich9r-4.html

Wednesday, August 11, 2010

exporting files from a specific user

/var/www/html/mp3 *(ro,sync,all_squash,anonuid=100,anongid=101)

This will answer request from nfs clients as if the request has come from the specific use anonuid:anongid

Monday, August 09, 2010

terminal services and iptables

for terminal services to work behind an iptables firewall, if the terminal server does not have a valid IP address, a full cone nat is required, which in iptables terms means that you need both a PREROUTING and a POSTROUTING statement.

Saturday, July 31, 2010

Friday, July 30, 2010

cpanel multiple forwarder

just create multiple lines of forwarders
info@x --> me@x
info@x--> you@x

Thursday, July 29, 2010

windows check listening ports

netstat -an |find /i "listening"

THANKS A MIL to PETRI

Tuesday, July 20, 2010

linux sendmail delete outgoing mails

delete in files in /var/spool/mqueue

also you can see the queue using mailq