Friday, September 25, 2009
Thursday, September 24, 2009
Fixing Aventail VPN software failure to connect
The only solution was to restart the computer.
in order to fix that try the following commands in DOS session:
ipconfig /release
ipconfig /renew
Other solution ( not verified )
The solution is to restart the "Network Location Awareness (NLA)" and "Aventail" services
You can save run the following commands in a batch file and run it:
net STOP Nla
net START Nla
net STOP NgVpnMgr
net START NgVpnMgr
ipconfig /release
ipconfig /renew
Thursday, September 10, 2009
Networking: Changing routing default gateway
Here is the command:
route change 0.0.0.0 mask 0.0.0.0 192.168.1.1
Saturday, August 8, 2009
Latest Whois database GeoIPCountryWhois.csv
It is updated on monthly basis and could be downloaded from several web locations.
Here is a good download server:
http://geolite.maxmind.com/download/geoip/database/
Thursday, July 9, 2009
Fix Firefox slow startup
To fix this problem do the following:
- Start Firefox3
- Go to Tools Menu >>> Option
- In options window chose Advanced >>> Network Tab >>>
- Click in connection box press Setting button
- (in the new window) chose Manual Proxy Configuration
- Type in the HTTP Proxy Field: 127.0.0.1 and Port: 0
- Click OK
- Click OK
- restart your firefox3
Tuesday, July 7, 2009
Using double colons in using Perl modules
The :: corresponds to a filesystem path separator.
A Module called Shape::Rect corresponds to a file named Shape/Rect.pm relative to a module library directory.
Wednesday, July 1, 2009
Using Route command to fix vpn issues
the default routing table to be the first hop in the network route.
You can run tracert
If the route does not lead to destination, route command could be used to fix that.
The "-p" switch would make the selected route persistent.
Run route help to check the available options.
Example: to access vmware machine directly without going through the vpn interface
route add 192.168.226.128 MASK 255.255.255.255 192.168.226.1 IF 2
Monday, June 29, 2009
Trace login activities
last
lastlog
faillog
w
finger
who -H
Good reference:
http://www.linuxhaxor.net/2007/11/21/6-ways-to-monitor-login-activity-from-the-command-line/
Sunday, June 28, 2009
changing linux password
passwd sleepy Change sleepy's password.
passwd -d sleepy Delete sleepy's password.
When you enter one of these commands to change a password, you will be prompted for the old (current) password and a new password. Your new password should be at least six characters long and not too easy for someone else to guess. Oh, and writing it down on a scrap of paper taped to your monitor is not recommended either. :-)
If you share your Linux system with multiple users, or if you have a dial-in modem attached, password security for each account is particularly important. But if you're the only one who will ever lay a finger on your system, you might want to delete your password, thus removing the need to enter it each time you log in. It's your call, but you never know when your five-year-old will wander by the keyboard!
By the way, you might get the idea from the preceding commands that users can go around changing each other's passwords at will, but that's not the case. Only a superuser (such as root) can change or delete another user's password.
For more information on the passwd command, see the passwd manual.
Reference:
http://lowfatlinux.com/linux-change-password-passwd.html
Sunday, May 31, 2009
Change Google Desktop Data folder
Google Desktop Data folder:
- 1. Stop Google Desktop (Right-click the tray icon->Exit)
- 2. Move Google Desktop Data directory to the desired location.
- 3. Run regedit (go to start -> Run… -> regedit)
- 4. Locate HKEY_CURRENT_USER\Software\Google\Google Desktop\data_dir
- 5. Change its value to the location, chosen in step 2
- 6. Start Google Desktop again
Friday, May 22, 2009
Vista Performance
Follow the steps below to make your windows faster:
1. Click on the Start Menu and key in SystemPropertiesPerformance and hit Enter.
2. On the Visual Effects tab uncheck Animate windows when minimizing and maximizing.
3. Click OK.
Thursday, May 21, 2009
Saturday, May 16, 2009
linux extract bz2 files
bzip2 -cd files.tar.bz2 | tar xvf -
reference:
http://www.kde.gr.jp/help/doc/kdebase/doc/khelpcenter/faq/HTML/bzip2.html
Friday, May 15, 2009
linux: fix X startup problems with small screens
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1024x768"
EndSubSection
EndSection
Thursday, May 14, 2009
FATAL: Module off not found. - Solution
You may see the following error in Fedora 8 while starting / restarting the network (service network restart):
FATAL: Module off not found.
Let's see how we can fix this.
This happens because you have entered a line in /etc/modprobe.conf to disable ipv6:
alias ipv6 off
In Fedora 8 you should change it to:
options ipv6 off
Now restart network:
service network restart
You will not see the error.
linux: usful text mode tools
ntsysv //configures startup services
linux keyring
gnome-keyring-manager is one application that manages passwords used by gnome environment.
TBC..
Wednesday, May 13, 2009
linux wirless commands
http://www.enterprisenetworkingplanet.com/netsecur/article.php/3594946
http://wirelessdefence.org/Contents/LinuxWirelessCommands.htm
Key folders:
/etc/wpa_supplicant/[wpa_supplicant.conf]
/etc/sysconfig/network-scripts/[ifcfg-eth0,ifcfg-wlan0]
Tuesday, May 12, 2009
linux: fix video detection problem
There was an error in detecting the display adapter VGA0 or VGA1
in order to fix it, i did the following
#switch to text console Alt-Ctrl-F2
#login as root
X -configure
cp /root/xorg.conf.new /etc/X11/xorg.conf
#reboot the system
Tuesday, May 5, 2009
Monday, May 4, 2009
linux: mounting LVM volume
http://www.linuxjournal.com/article/8874
#Scan the available volume groups
vgscan
#Scan the available physical voulmes
pvscan
# make the volumes available as /dev/VolGroup??/LogVol??
vgchange -a y
#Scan available logical volumes
lvscan
# mount the required volume ( last volume usually unused )
mkdir /mnt/any_name
mount -t ext /mnt/any_name /dev/VolGroup00/LogVol00
linux: list support file types
or
cat /proc/filesystems
It is also good way to check the type of attached devices.
file types with no device attached will show "nodev"
Sunday, May 3, 2009
linux: watch command
Example: watch df
Would pull the output of df command every 2 seconds
Saturday, May 2, 2009
wget: a usful linux tool to check webservers' response
Using this tool was the reason to detect the week long problem in kobool server which caused 50% of the user to fail to open kobool.com.
The failure was that Internet explorer was hanging during load time.
I found that the header contained Content-Type: text/html; charset=UTF-8 which was not found in the old server. By commenting DefaultCharset utf-8 in httpd.conf, the problem was solved.
Tuesday, April 28, 2009
linux startx failure resolved
Resolution:
In system setup, increased the AGP buffer from 32MB to 64MB
Monday, April 27, 2009
Fedora 10 update GDM config to allow root login
Type your root password. Next, make a backup of /etc/pam.d/gdm, enter:
cp /etc/pam.d/gdm /root
Now open /etc/pam.d/gdm using gedit or vi text editor, enter:gedit /etc/pam.d/gdm
ORvi /etc/pam.d/gdm
Alternatively, you can do everything in a one command:su -c 'gedit /etc/pam.d/gdm'
Find line that read as follows:
auth required pam_succeed_if.so user != root quiet
Remove or comment out line by prefixing #.
# auth required pam_succeed_if.so user != root quiet
Save and close the file. Logout from terminal and from GUI itself. Now you should be able login as root user using GDM GUI login manager.
linux graphical display configuration (X or Xorg)
X -configure
you can use the created file by copying it to /etc/X11/xorg.conf
or set it via:
X -config xorg.conf.new
to get all availbale commands:
X -help
To view the log information:
tail /var/log/xorg.0.log
Fix linux booting when moving hard drive to another motherboard
The image file is located under (/boot/initrd-(kernel version).img)
if this image is not compatible with the current hardware, then we need to create a new one under the same hardware devices.
All we need is Fedora installation disk 1 to boot up in a "rescue mode" and do the follow:
- chroot /mnt/sysimage
- mkinitrd initrd_new-(kernel version, use the latest number, it can also be found under /lib/module/) (kernel version)
i.e. : mkinitrd /boot/initrd_new-2.4.18-0.12.img 2.4.18-0.12
- vi /boot/grub/menu.ls
- replace the current initrd file name with the newly created one
- exit then exit to reboot the system
Issues with kobool server migration
- Comment: AddDefaultCharset UTF-8
- Adding NameVirtualHost *:80
- Adding AllowOverride all to root folders ( it was all by default in Apache 2.0, but none in 2.2 )
- Adding Option +Include to default folder
- Adding AddOutpuFilter INCLUDES .htm
- Adding AddOutpuFilter INCLUDES .html
- Changing Timeout from 120 to 30
- Adding ExpiresActive On
- Adding ExtendedStatus On
- Setting ServerName www.kobool.com:80
- Setting SSL server root folder and server name to kobool.com
ssl.conf> ServerName kobool.com:443
ssl.conf>DocumentRoot /var/www/html/kobool.com
Skipped httpd.conf:
- commenting AddDefaultCharset UTF-8
- commenting ErrorLog logs/error_log
- commenting CustomLog logs/access_log combined
- removing index.php from DirectoryIndex
- KeepAlive On
- MaxKeepAliveRequrest 0 instead of 100
- KeepAliveTimeout 20
Perl script:
- Replacing encode() with Encode::from_to($text,"utf8", "MIME-Q",1) in window1256.pm
- paid2cashu.pl: remove "dbcards" from db_connect()
Email header encoding problem fixed
But, using Encode::from_to($text, "utf8", "MIMI-Q", 1) gave the right encoding for email header.
Probably because of the last parameter (1)
Sunday, April 26, 2009
remove kobool mailer ip address from exclude black list (xbl)
as it was listed in CBL at: http://cbl.abuseat.org/lookup.cgi?ip=154.6.115.157
The reason was the hostname was not set to xxx.kobool.com
Fix:
edit /etc/sysconfig/network
and set hostname to: main.kobool.com
restart the machine.
mail loops back to me mx problem
localhost
localhost.localdomain
kobool.com
muslim-web.com
mail.kobool.com
main.kobool.com
Saturday, April 25, 2009
linux networking change computer name in the local network
edit /etc/sysconfig/network
NETWORKING=yes
HOSTNAME="main.kobool.com"
Note: changing HOSTNAME requires rebooting the computer to take effect
Friday, April 24, 2009
Apache: applying configuration chages without restarting
or
apachectl -k graceful
references:
http://www.cyberciti.biz/faq/apache-making-changes-config-file-without-restarting/
Edit network configuration for a network adapter controlled by Network Manager
static ip address could be set for this interface as well
Thursday, April 23, 2009
Wednesday, April 22, 2009
Assign static IP addresses for libvirt hosts
virsh net-edit default
Add host tag inside dhcp with the following attributes:
mac='xx:xx:xx:xx:xx:xx'
name='slaveX'
ip='192.168.122.nn'
linux dhcp server configuration
dnsmasq [options]
Or edit /etc/dnsmasq.conf to change the settings
virsh-clone error "list index out of range" resolution
This usually happen if CD rom drive is defined.
Resolution:
Remove the CD from device list of the source machine.
Tuesday, April 21, 2009
linux Screen utility
Key | Action | Notes |
Ctrl+a c | new window | |
Ctrl+a n | next window | I bind F12 to this |
Ctrl+a p | previous window | I bind F11 to this |
Ctrl+a " | select window from list | I have window list in the status line |
Ctrl+a Ctrl+a | previous window viewed | |
| ||
Ctrl+a S | split terminal horizontally into regions | Ctrl+a c to create new window there |
Ctrl+a :resize | resize region | |
Ctrl+a :fit | fit screen size to new terminal size | Ctrl+a F is the same. Do after resizing xterm |
Ctrl+a :remove | remove region | Ctrl+a X is the same |
Ctrl+a tab | Move to next region | |
| ||
Ctrl+a d | detach screen from terminal | Start screen with -r option to reattach |
Ctrl+a A | set window title | |
Ctrl+a x | lock session | Enter user password to unlock |
Ctrl+a [ | enter scrollback/copy mode | Enter to start and end copy region. Ctrl+a ] to leave this mode |
Ctrl+a ] | paste buffer | Supports pasting between windows |
Ctrl+a > | write paste buffer to file | useful for copying between screens |
Ctrl+a < | read paste buffer from file | useful for pasting between screens |
| ||
Ctrl+a ? | show key bindings/command names | Note unbound commands only in man page |
Ctrl+a : | goto screen command prompt | up shows last command entered |
Run a command on virtual terminal
openvt -vl /bin/bash
To specify terminal #9:
openvt -c 9 -vl /bin/bash
Adding replication slave user
Monday, April 20, 2009
changing mysql root password
SET PASSWORD FOR 'bob'@'%.loc.gov' = PASSWORD('newpass
');
That is equivalent to the following statements:
UPDATE mysql.user SET Password=PASSWORD('newpass
')
WHERE User='bob' AND Host='%.loc.gov';
FLUSH PRIVILEGES;
configuring service autostart option
To check the service startup option in different runlevels (i.e. mysqld):
chkconfig | grep mysqld
to enable a service in all runlevels
chkconfig mysql on
to enable a service in specific runlevel
chkconfig --level 3 mysqld on
To add a new service:
chkconfig --add mysqld
Linux RunLevels:
0 - System halt; no activity, the system can be safely powered down.
1 - Single user; rarely used.
2 - Multiple users, no NFS (network filesystem); also used rarely.
3 - Multiple users, command line (i.e., all-text mode) interface; the standard runlevel for most Linux-based server hardware.
4 - User-definable
5 - Multiple users, GUI (graphical user interface); the standard runlevel for most Linux-based desktop systems.
6 - Reboot; used when restarting the system.
Sunday, April 19, 2009
Shredding data using linux
sample
shred -vfz -n 100 /dev/sdb
Here /dev/sdb is my whole hard disk. And I am asking shred to make (-n) 100 passes by overwriting the entire hard disk with (-z) zeros. And shred program (-f) forces the write by changing the permissions wherever necessary.
Saturday, April 18, 2009
delete hard drive content using dd command
dd if=/dev/zero of=/dev/sd(a|b|c) bs=1024
To earse from specific offeset in the output device add seek=(blocks count)
for example to start erasing at 10 KB:
dd if=/dev/zero of=/dev/sdb bs=1024 seek=10
Friday, April 17, 2009
linux vituralization commands
http://virt-manager.et.redhat.com/index.html
https://help.ubuntu.com/8.10/serverguide/C/libvirt.html
management shell:
virsh
Install virtrual machine
virt-install
Clone virtual machine
virt-clone
Search for text in a folder using grep
grep text_to_find wildcard
Sample
grep XEN /boot/*
Clonning VirtualBox hard disk on the same machine
"C:\Program Files\Sun\xVM VirtualBox\VBoxManage.exe" clonevdi "mydisk.vdi"
"mydisk2.vdi"
If there are snapshots, the new disk will contain the root disk version before taking any snapshots.
In order to get the latest disk, all snapshots have to be discarded ( or merged )
Thursday, April 16, 2009
Change hostname on Fedora Core
To change the hostname on a Fedora Core system, firstly edit these lines in the "/etc/hosts" file:
127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost
Then, in the "/etc/sysconfig/network" file, write new hostname in that line: "HOSTNAME=localhost.localdomain"
To make the changes permanent, the network service must be restarted via this command:
# service network restart
Showing linux active processes
ps
common options are: aux
Sample:
ps aux
To find a specific process pipe the output to grep
Sample:
ps aux | grep Network
Wednesday, April 15, 2009
Installing flash-plugin on Fedora 10 64 bit
http://fedoraproject.org/wiki/Flash
1. Install flash yum version from adobe site
2. run:
yum install flash-plugin nspluginwrapper.x86_64 nspluginwrapper.i386 alsa-plugins-pulseaudio.i386 libcurl.i386
Tuesday, April 14, 2009
Saving disk image with linux dd command
dd if=/dev/sda bs=1024 | gzip > /path/to/image.gz
to restore:
gunzip < /path/to/image.gz | dd of=/dev/sda bs=1024
Note:
Add "count=1 bs=446" to exclude the partition table from being written to disk. You can manually restore the table.
Firewall commonly required open ports
- 21: ftp
- 22: ssh
- 23: telnet
- 25: smtp
- 80: http
- 110: pop3
- 137upp, 138udp, 139tcp, 445tcp: Samba
- 443: https
- 873: rsync
- 995: pop3 over ssl
- 2049: NFS
- 3306: mysql
- 5900: vnc
- 5901: xvnc
- 10000: webmin
How to setup a mysql slave server to works as a master for other servers
However, slave updates will not be logged in master logs unless "log-slave-update" variable is set in my.cnf or via CHANGE MASTER TO statement
my.cnf:
[mysqld]
log-slave-update
or:
CHANGE MASTER TO --log-slave-update
Monday, April 13, 2009
MySQL Bulk update instructions and sample
- create temporary table and fill it in with the data that would be used to update your target table
- update target table joined with the temporary table and set the records fields values to the values of the temp table records.
this technique was used in 4h_cron.pl and a huge gain of performance was achieved.
#Update ask_count
$dbh->do(
qq{
create temporary table tmp_questions_text(
id integer auto_increment,
question integer,
ask_count integer,
primary key (id)
)
}
);
$dbh->do(
qq{
insert into tmp_questions_text (question, ask_count)
select question, count(question) as ask_count
from questions
group by question
}
);
$ret_info->{updated_questions} = int(
$dbh->do(
qq{
update questions_text
join tmp_questions_text
on questions_text.id = tmp_questions_text.question
and questions_text.ask_count <> tmp_questions_text.ask_count
set questions_text.ask_count = tmp_questions_text.ask_count
}
)
);
Creating linux user for email account only
Mailbox will not be created until first email is received.
dovecot will give +w permission not found when mailbox is not found, as dovecot does not have permission to create files in /var/mail/ folder.
Reference:
http://www.tecmint.com/add-users-in-linux/
Thursday, April 9, 2009
MySQL debuggin via EXPLAIN or DESCRIBE
No conclusion yet
http://dev.mysql.com/doc/refman/5.0/en/using-explain.html
Wednesday, April 8, 2009
mysql 5.x hangs in copy to tmp table
It is a known bug in version 5. It looks like it is going to be fixed with 6.0 release.
However, here are some reasons:
-Tables are over indexed: reduce the number of indexes solved the problem with some cases
Monday, April 6, 2009
mytop tool
There is one error in first time run which could be fixed by following the instructions in this post:
http://forums.cpanel.net/showthread.php?p=497485
Friday, April 3, 2009
kobool setup issues
- use sftp or rsync to get files from remove servers
- use nfs to get files from local network servers
- install CPAN ( yum install perl-CPAN.x86_64 )
- Apache: make sure startup.pl is located in one of the @INC folders ( i.e. : /etc/httpd )
- Apache: verify the used lib folders in use() statement in startup.pl
- Apache: enable index.shtml as folder index document
- Apache: enable shtml processing with htm extensions ( AddOutputFilter INCLUDES .htm )
- Apache: check error log at /var/log/httpd/error_log
- httpd.conf > uncomment NameVirtualHost
- start dovecot
- grant all on *.* to 'root'@'123.233.423.34' identified by 'passw'
Apache Virtual Hosts overlap problem
http://www.heavymind.net/2007/07/25/virtualhosts-nightmare-on-suse/
Installing perl CPAN
yum install perl-CPAN.x86_64
then to install CPAN module (i.e. IP::Country):
perl -MCPAN -e shell
then
install IP::Country
to search for a package
i /package name/
Wednesday, April 1, 2009
Show line numbers in vi and vim
To set it permanently:
edit or creat .exrc in your linux home folder
add "set number" in a separate line
linux: listing active listening services
chkconfig --list | grep 3:on
Sample (netstat -ltp )
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 *:nfs *:* LISTEN -
tcp 0 0 *:mysql *:* LISTEN 2309/mysqld
tcp 0 0 *:40971 *:* LISTEN -
tcp 0 0 *:rquotad *:* LISTEN 2191/rpc.rquotad
tcp 0 0 *:vnc-server *:* LISTEN 3036/vino-server
tcp 0 0 *:sunrpc *:* LISTEN 1798/rpcbind
tcp 0 0 *:ndmp *:* LISTEN 2521/perl
tcp 0 0 *:http *:* LISTEN 2383/httpd
tcp 0 0 *:55632 *:* LISTEN 2206/rpc.mountd
tcp 0 0 *:ftp *:* LISTEN 2227/vsftpd
tcp 0 0 *:ssh *:* LISTEN 2103/sshd
tcp 0 0 *:36374 *:* LISTEN 1813/rpc.statd
tcp 0 0 localhost.localdomain:ipp *:* LISTEN 2447/cupsd
tcp 0 0 localhost.localdomain:smtp *:* LISTEN 4982/sendmail: acce
tcp 0 0 *:https *:* LISTEN 2383/httpd
Thursday, March 5, 2009
Implement Quran Search Ajax
-Think about the same thing for other searches ( marriage, classifieds, jobs, etc )
Thursday, February 26, 2009
Port forwarding for VNC session
http://www.ep.ph.bham.ac.uk/general/support/vncsetup.html
Thursday, February 12, 2009
installing vnc server on Fedora 10
To install the service:
yum install vnc-server
You can then access GNOME session without having a physical console.
To learn how to setup this, read:
http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/
Friday, February 6, 2009
Showing Linux disks information
Sample output:
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0008dc7b
Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 60801 488183220 8e Linux LVM
Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000d4e6e
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 13 104391 83 Linux
/dev/sdb2 14 10011 80308935 8e Linux LVM
/dev/sdb3 10012 19457 75874995 8e Linux LVM
Fedora root UI login
Fedora 10 update GDM config to allow root login
Type your root password. Next, make a backup of /etc/pam.d/gdm, enter:
cp /etc/pam.d/gdm /root
Now open /etc/pam.d/gdm using gedit or vi text editor, enter:gedit /etc/pam.d/gdm
ORvi /etc/pam.d/gdm
Alternatively, you can do everything in a one command:su -c 'gedit /etc/pam.d/gdm'
Find line that read as follows:
auth required pam_succeed_if.so user != root quiet
Remove or comment out line by prefixing #.
# auth required pam_succeed_if.so user != root quiet
Save and close the file. Logout from terminal and from GUI itself. Now you should be able login as root user using GDM GUI login manager.