Vijay's Blog Experience is something you don’t get until just after you need it.—(MeMySeLf@vijaylad.com)

6Apr/100

Subversion (SVN) Tips

Posted by admin

Latest findings on subversion.

  • Adding a new user in SVN :- Subversion keep all users information in " svn-auth-file". Which you will find at /etc/subversion or /usr/local/subversion  folder.

To create a new user or reset password for particular user :

htpasswd -m /etc/subversion/svn-auth-file vijay
New password: ****
Re-type new password: ****
Adding password for user vijay
Filed under: Uncategorized No Comments
12Oct/090

Linux Family Tree

Posted by admin

I got this yesterday when I was searching for something else. Looks interesting & I think every Linux user should know this...

Linux family

Linux family

Source Image : http://www.codinghorror.com/blog/images/unix-family-tree.png

23Sep/090

How to Reset .htaccess password?

Posted by admin

I use .htaccess to protect my web directories. Today I forgot one of directory password. After googling I got the way how to reset the password for .htaccess.
Htaccess use the DES encoding for the password. There are so many utilities available, but I feel this one is more comfortable.

--> Go to the directory for which you wants to reset the password.
--> Open .htaccess file, there you will find the location of password file.
e.g.
--------------------------------------------------------
# Deny all users web access to this directory
AuthType Basic
AuthName "Restricted Access"
AuthUserFile /home/superman/secure/hpasswds --(It can be different, I use this one..)
Require user superman
--------------------------------------------------------
--> Go to Password Generator website
Here just enter you desired password & copy the output.

--> Now Open "AuthUserFile" using vi
# vi /home/superman/secure/hpasswds
------------------------------
superman:oV3UXw23he71U (Here superman is user & "oV3UXw23he71U" is encrypted password.
------------------------------
Just replace the old password from above file with password generated on website.

--> Done .. Now access website with your new password.

By: Vj

22Sep/090

How to Check System Hardware in Linux

Posted by admin

Yesterday I wanted to check how many memory slots are used in my system.  Earlier when I was using windows system (5-6 years back), I used "Belarc Advisor" to check this kind of details. It was really a good utility. But I think it wont work in Linux. I asked my GEEK-GURU, he told me the best tool to know the complete system info. Which shows everything from enabled Bios option to motherboard serial no.  That is "dmidecode".

"Dmidecode" is a tool for dumping a computer's DMI (some say SMBIOS ) table contents in a human-readable format. This table contains a description of the system's hardware components, as well as other useful pieces of information such as serial numbers and BIOS revision. Thanks to this table, you can retrieve this information without having to probe for the actual hardware. While this is a good point in terms of report speed and safeness, this also makes the presented information possibly unreliable.

The DMI table doesn't only describe what the system is currently made of, it also can report the possible evolutions (such as the fastest supported CPU or the maximal amount of memory supported).

SMBIOS stands for System Management BIOS , while DMI stands for Desktop Management Interface. Both standards are tightly related and developed by the DMTF (Desktop Management Task Force).

As you run it, dmidecode will try to locate the DMI table. If it succeeds, it will then parse this table and display a list of records like this one:

Handle 0x0002 DMI type 2, 8 bytes.
Base Board Information
Manufacturer: Intel
Product Name: C440GX+
Version: 727281-001
Serial Number: INCY92700942

Each record has:

* A handle. This is a unique identifier, which allows records to reference each other. For example, processor records usually reference cache memory records using their handles.
* A type. The SMBIOS specification defines different types of elements a computer can be made of. In this example, the type is 2, which means that the record contains "Base Board Information".
* A size. Each record has a 4-byte header (2 for the handle, 1 for the type, 1 for the size), the rest is used by the record data. This value doesn't take text strings into account (these are placed at the end of the record), so the actual length of the record may be (and is often) greater than the displayed value.
* Decoded values. The information presented of course depends on the type of record. Here, we learn about the board's manufacturer, model, version and serial number.

Options

-d, --dev-mem FILE
Read memory from device FILE (default: /dev/mem)
-q, --quiet
Be less verbose. Unknown, inactive and OEM -specific entries are not displayed. Meta-data and handle references are hidden. Mutually exclusive with --dump.
-s, --string KEYWORD
Only display the value of the DMI string identified by KEYWORD. KEYWORD must be a keyword from the following list: bios-vendor, bios-version, bios-release-date, system-manufacturer, system-product-name, system-version, system-serial-number, baseboard-manufacturer, baseboard-product-name, baseboard-version, baseboard-serial-number, baseboard-asset-tag, chassis-manufacturer, chassis-version, chassis-serial-number, chassis-asset-tag, processor-manufacturer, processor-version. Each keyword corresponds to a given DMI type and a given offset within this entry type. Not all strings may be meaningful or even defined on all systems. Some keywords may return more than one result on some systems (e.g. processor-version on a multi-processor system). If KEYWORD is not provided or not valid, a list of all valid keywords is printed and dmidecode exits with an error. This option cannot be used more than once, and implies --quiet. Mutually exclusive with --type and --dump.
-t, --type TYPE
Only display the entries of type TYPE. TYPE can be either a DMI type number, or a comma-separated list of type numbers, or a keyword from the following list: bios, system, baseboard, chassis, processor, memory, cache, connector, slot. Refer to the DMI TYPES section below for details. If this option is used more than once, the set of displayed entries will be the union of all the given types. If TYPE is not provided or not valid, a list of all valid keywords is printed and dmidecode exits with an error. Mutually exclusive with --string.
-u, --dump
Do not decode the entries, dump their contents as hexadecimal instead. Note that this is still a text output, no binary data will be thrown upon you. The strings attached to each entry are displayed as both hexadecimal and ASCII . This option is mainly useful for debugging. Mutually exclusive with --quiet and --string.
-h, --help
Display usage information and exit
-V, --version
Display the version and exit

Dmi Types
The SMBIOS specification defines the following DMI types:
Type     Information
0
1     System
2     Base Board
3     Chassis
4     Processor
5     Memory Controller
6     Memory Module
7     Cache
8     Port Connector
9     System Slots
10     On Board Devices
11     OEM Strings
12     System Configuration Options
13     BIOS Language
14     Group Associations
15     System Event Log
16     Physical Memory Array
17     Memory Device
18     32-bit Memory Error
19     Memory Array Mapped Address
20     Memory Device Mapped Address
21     Built-in Pointing Device
22     Portable Battery
23     System Reset
24     Hardware Security
25     System Power Controls
26     Voltage Probe
27     Cooling Device
28     Temperature Probe
29     Electrical Current Probe
30     Out-of-band Remote Access
31     Boot Integrity Services
32     System Boot
33     64-bit Memory Error
34     Management Device
35     Management Device Component
36     Management Device Threshold Data
37     Memory Channel
38     IPMI Device
39     Power Supply

How to use?

system # dmicode -t  <type>

e.g.   superbox# dmicode -t 17

I have used 17 becuase I wanted to know about Memory.  You can can select whatever type you wanted to know about.

To know more about "DMICODE" please refer  following :

http://www.nongnu.org/dmidecode/

4Sep/090

Running Gnome session in VNC Server

Posted by admin

Running Gnome session in VNC Server

* Login as root
* edit vnc start file
---> vi  ~/.vnc/xstartup
___________________________________________
#!/bin/sh

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
__________________________

# Replace "twm &" with "gnome-session &"

# Restart vnc server. you are done!!

13May/090

Configuring Linux Box as Firewall

Posted by admin

Configuring Linux Box as Firewall

Aim: Setup an simple gatway with firewall for small network

Requirement :
#Linux box with iptables (It comes default with most of distros)
#One ethernet is for DSL, Cable, T1 etc.
#Second ethernet is for local network

Steps :-
# Login as root on your system.
# Create a scripts to run all iptables commands together.
-- [root@superbox ~]# vi router.sh
Add following lines in the script

#!/bin/bash
set -x # you can disable this after testing
/sbin/iptables -F
/sbin/iptables -t nat -F
/sbin/iptables --delete-chain
/sbin/iptables -t nat --delete-chain
/sbin/iptables -t nat -A POSTROUTING --out-interface eth0 -j MASQUERADE
/sbin/iptables -A FORWARD --in-interface eth1 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
exit 0;

-- Save & close the file
-- [root@superbox ~]# chmod a+x router.sh (change the file attributes)
-- [root@superbox ~]# ./router.sh
Output for above command should be like this.
+ /sbin/iptables -F
+ /sbin/iptables -t nat -F
+ /sbin/iptables --delete-chain
+ /sbin/iptables -t nat --delete-chain
+ /sbin/iptables -t nat -A POSTROUTING --out-interface eth0 -j MASQUERADE
+ /sbin/iptables -A FORWARD --in-interface eth1 -j ACCEPT
+ echo 1
+ exit 0

Now check your default gatway. Its should be same as provided by ISP

-- [root@superbox ~]# route -n

If you wants to make any changes in routing you can use following commands.

-- [root@superbox ~]# route del default gw xx.xxx.xxx.xx (This you can use to add default gatway)
-- [root@superbox ~]# route add default gw xx.xxx.xxx.xx (This you can use to del default gatway

You are done now, just add Linux Box's IP as your local gatway & start using.
To start this script automatically add it in /etc/rc.d/

BY:Vj

25Apr/090

Antivirus for Linux

Posted by admin

I hear new Linux users ask is "What program should I use for virus protection?"  The answer of this question from my end is "Not Required". As you know, peoples shifting from windows environment are always worried about viruses.

Only worms are most commonly written for the Windows OS, although a small number are also written for Linux and Unix systems. Worms today work in the same basic way as 1988's Internet Worm: they scan the network and leverage vulnerable computers to replicate.

For More Details Check this:

http://en.wikipedia.org/wiki/List_of_Linux_computer_viruses#Worms

There are a growing number of companies and GNU Projects coming forward to provide Linux antivirus products.

Installation for all of these products is straightforward and quite easy. Even novice users should be able to follow along without confusion. Most products provide the same basic capabilities, but some provided additional features, such as mail gateway server protection or file server protection.

I have recently got requirement from my friend that he require antivirus on his servers, so I have installed "ClamAV" on his servers.

How to install ClamAV?

Manual Installation

You can install clamav by compiling RPM packages.

1. Compiling source: download from clamav site.
2. Installing RPM package. Download

I tried to download and compile source package, but i got zlib error complaining the version not updated. so tried RPM and just able to install for myself.

By default clamav doesnt come with centos or perhaps with yum. You have to find rpm repository and install it.

Here is how you install clam antivirus (freely available) in centos running with cpanel.

yum install clamd

[OR]

yum install clamav

If it doesnt work use this

rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.i386.rpm

follow this instructions here based on centos version (Locate B2 in that page)

after installing that you can issue

yum install clamd

[OR]

yum install clamav

either of those should work.

Once you have installed clamav in your centos…here are some of the basic commands using the software..

1. To update the antivirus database

> freshclam

2. To run antivirus

clamav -r /home

3. Running as Cron Daily Job

To run antivirus as a cron job (automatically scan daily) just run crontab -e from your command line. Then add the following line and save the file.

30 1 * * * root clamscan -R /usr/local/apache2/htdocs

This will run the cron job daily @ 1.30 AM by scanning the Apache Document Root folder. You can change the folder to whatever you want for mail etc.

Filed under: Linux No Comments
25Apr/094

server: /usr/local/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied

Posted by admin

Today I have faced a weired problem. I have compiled apache-php so many times till today. BUt havn't faced this kind of problem.

Installation of both packages were fine without any error. As soon as I completed installation, I stopped apache, but I cant. The following error appeared.

" Syntax error on line xxx of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied "

After googling for whole day I have found the solution. Actually this is NOT a syntax error in the httpd.conf file in spite of the error message - but it does (correctly) point to a line number at which it had an issue.And in this case the issue is ... the security setting for SELinux that was selected at the time the operating system was installed.

To get past the problem and allow the PHP Install to complete, we need to just turned enforcement off ..

e.g. [root@ superbox ]# setenforce 0

[root@superbox]# /usr/local/apache2/bin/apachectl start

Gr8 ....Its started........

What this command do exactly?

Setenforce change the mode of SELinux is running in.
Synopsis: "setenforce [ Enforcing | Permissive | 1 | 0 ]"

Use Enforcing or 1 to put SELinux in enforcing mode.  Use Permissive or
0 to put SELinux in permissive mode.  You need to modify /etc/grub.conf
or /etc/selinux/config to disable SELinux.

But as per some geek readers we can actually resolve this problem by using following.

chcon -t textrel_shlib_t '/usr/lib/httpd/modules/libphp5.so'    ( Thanks to Josh & jinxingvenus)

IF this wont work, then please go ahead & turn off the SELINUX.

By-Vj

25Mar/093

Bugzilla Migration

Posted by admin

I was facing problem with my existing bugzilla server, some hardware issues. I am bit confused what to do, I never done this before ever.

After googleing for some hrs I found the  solution, half part done by those search, but still it wont work. Then i took help from my boss & my system is online now.

There are two things which I wants to do!!

1. Need to transfer complete Bugzilla to another server.

2. Need to upgrade it with latest  available version.

First I have install new bugzilla & then import old data in new. Following are the steps for the same.

On New Server:-

# wget  http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-3.2.2.tar.gz  (Download Latest Version)

#tar -xvzf bugzilla-3.2.2.tar.gz (Untar)

# mv bugzilla-3.2.2 bugzilla (Rename as bugzilla)

#cp -R bugzilla /usr/local/apache2/htdocs/ (Move it to Document root of your webserver)

#chmod -R 655 bugzilla/ (Change Mode)

Now login in mysql & create database & username.

mysql> CREATE DATABASE bugs;

mysql>grant all on bugs.* to bugs@localhost identified by 'Your Password'; (Dont forget to mention this details in localconfig)

# cd /usr/local/apache2/htdocs/bugzilla

#./checksetup.pl      (Run this file to check all dependencies are available or not)

This will ask you many questions just answer it properly, you will need administrator name, ID & localtion of perl installation. If any module is not available, it wont proceed further. Just install all required packages of perl.

If that file finished properly, you are ready with all database info & required settings.

Old Server:-

Now copy contents of data folder ("/bugzilla/data/" ) to new server's installation directory ("/bugzilla/data/"). Also copy "localconfig" file to new server.

Take backup of you bugzilla database using  following comand:

# mysqldump --opt -u root -p bugs > bugs.sql

Copy "bugs.sql file" to new server.

New Server:

Restore sql data to mysql using following command:

# mysql -uroot -p bugs < bugs.sql

Now run that "./checksetup.pl" file again.

Go to web url & try to login with ur existing username password.

Done!!! Your new bugzilla with old data is ready..............

24Feb/090

Download VMware images

Posted by admin

Chrysaor.info provides VMware images for Debian, OpenBSD and Ubuntu.

VMware images from Chrysaor.info are high-quality VMware images that have VMware Tools installed for maximum performance. You can download the images via Bittorrent.

Chrysaor.info has its own Bittorrent tracker and some servers seeding all time.

This images are available with all information like following.

VMware info
- RAM : 256 MB
- Networking : Bridged
- Harddisk : 8 GB SCSI (expanding)
- VMware tools : Installed

OS info
- OS : Debian 4.0
- Installation : Standard
- Hostname : debian40server
- Patches : till date of creation
- IPv4 address : dhcp
- IPv6 address : dhcp
- DNS name : none
- Nameserver : dhcp
- Route : dhcp
- Root password: not set
- User login : user
- User password: user
- Keyboard : US-int
- Date created : 10-05-2007

This is useful for all new users, who really wants to learn & develop there knowledge about linux.

Filed under: Linux No Comments