Ahoy there! This is my personal blog which I use as my memory extension and a medium to share stuff that could be useful to others.

Problem:

When trying to connect to a server via SSH, the authentication is slow (takes a few seconds), but the server seems normally responsive after authentication.

Background & Analysis:

I’ve experienced this problem when trying to connect to Linux hosts using SSH. Som of my Linux hosts use OpenSSH and some use Reflection for Secure IT Server.

When authenticating via SSH, the SSH server will perform a reverse domain lookup of the client’s IP address and this delays the authentication process.

SSH servers have options in their configurations to disable the reverse domain lookup of clients’ IP addresses.

Solution:

Disable reverse domain lookup of the client’s IP address in the SSH Server Configuration. Given below are examples of how this is done in two SSH servers:

OpenSSH: Edit /etc/ssh/sshd_config (or wherever your config file is) and set

UseDNS=no

RSIT: Edit /etc/ssh2/sshd2_config and set

ResolveClientHostname=no

Root Cause:

Slow Reverse Domain Lookup of clients’ IP addresses.

 

(1) The solution above describes a successful problem-solving experience and may not be applicable to other problems with similar symptoms.

(2) Your rating of this post will be much appreciated as it gives me and others who read this article, an indication of whether this solution has worked for people other than me. Also, feel free to leave comments.

 

VN:F [1.6.5_908]
Rating: +3 (from 3 votes)

In trying to make my team aware of what’s in our team’s wiki (based on Mediawiki), I wanted a simple notification to go out to the team daily listing the new wiki pages created on the previous day. This may be achieved with a simple shell script that queries the Mediawiki recentchanges table.

STEP 1: Deploy Shell Script

The following script queries the recentchanges table and fetches data for pages created (rc_type = 1) the previous day in the Main namespace (rc_namespace = 0).

#!/bin/bash
# Author         :       Cybergavin (http://www.cybergav.in)
# Date Created   :       31st March 2012
# Description    :       This simple script queries the Wiki database and sends a notification to specific users regarding page creation. Reminds users about the existence of the wiki and what's in there.
#####################################################################################
#
# Variables
#
EMAIL_RECIPIENTS="wikiusers@abc.com"
REPORT_DATE=$(date '+%Y%m%d' --date="yesterday")
REPORT_DATE_FORMAIL=$(date '+%d-%b-%Y' --date="yesterday")
WIKI_BASEURL="http://wiki.abc.com/wiki/index.php/"
#
# Functions
#
getDBdata()
{
mysql -u wiki -p'xxxxx' --skip-column-names wiki <<EOSQL
connect wiki;
select rc_title, rc_user_text from recentchanges
where rc_timestamp like '$REPORT_DATE%'
and rc_type = 1
and rc_namespace=0;
quit
EOSQL
}
#
# Main
#
mail -s "Tech Ops Wiki : New Page Notification For $REPORT_DATE_FORMAIL" $EMAIL_RECIPIENTS <<EOMAIL
Hi

Given below are Pages created on the ABC Wiki ( http://wiki.abc.com ) yesterday ($REPORT_DATE_FORMAIL) along with their authors:

`getDBdata | awk -v a="$WIKI_BASEURL" '{printf "%-70s %s %s\n", a$1,"-", $2}'`

EOMAIL
#
##################################### T H E     E N D ###############################

NOTE:
(1) You must change certain variables and the body of the email as per your requirements.
(2) If your wiki isn’t updated with new pages very often, you may send this notification weekly. To do so, simply replace “yesterday” by “last week” on lines 11 and 12 and replace “where rc_timestamp like ‘$REPORT_DATE%’” by “where rc_timestamp > $REPORT_DATE0000″

STEP 2: Cron the Shell Script

Set up a cron job to send a daily notification. The example below executes the script daily at 9 AM.

0 9 * * * /opt/support/wikiPCnotify.sh > /opt/support/wikiPCnotify.out 2> /opt/support/wikiPCnotify.err
VN:F [1.6.5_908]
Rating: 0 (from 0 votes)

Unknown groups in SLES

Problem:

On SLES 11 SP 1, while trying to add users with the useradd command, the following is displayed:

useradd: Unknown group `video’.
useradd: Unknown group `dialout’.

Background & Analysis:

The “video” and “dialout” groups are default groups in SLES. This is configured in /etc/default/useradd.

These groups were removed from /etc/group using the groupadd command although the useradd command uses them as default groups.

Solution:

STEP 1: Modify /etc/default/useradd

Edit /etc/default/useradd and remove video and dialout from the GROUPS directive. After doing so, my /etc/default/useradd looks like this (I have removed the GROUPS directive as I do not want default groups):

GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes

 

 

VN:F [1.6.5_908]
Rating: 0 (from 0 votes)

There are PHP applications which use MSSQL as the back-end database and such applications require FreeTDS to enable PHP code interface with MSSQL. This article describes how to install PHP and FreeTDS on Linux hosts.

To compile or not?: Typically, it is recommended to use package managers like yum to install software on Linux platforms. Using package managers facilitates installation and administration (e.g. updates) of the software. However, when the software requires special options to be set or modules/extensions to be enabled, it may be difficult to obtain software built to suit those requirements. In such cases, it will be required to compile the software from its source. If compiling, then it will be prudent to organize all compiled software in standard locations on the host.

Given below are the implementation steps that were used for installing PHP 5.3.3 and FreeTDS 0.91 on RHEL 6.2.

NOTE: All commands in the examples below must be executed with root privileges, unless otherwise stated.

STEP 1: Create Installation Directory Structure

  • Use the following commands to create an appropriate directory structure for compiled software:
mkdir /opt/src
  • Use a standard location (e.g. /opt) to install all software compiled from source to facilitate administration (re-compilation, removal, etc.)

STEP 2: Download and Unpack Software Source

  • Download software sources (typically *.tar.gz files) and place them in /opt/src
  • Unpack source software (*.tar.gz) as per the following examples:
tar xfz php-5.3.3.tar.gz
tar xfz freetds-0.91.tar.gz

The above commands will create directories /opt/src/php-5.3.3 and /opt/src/freetds-0.91

STEP 3: Compile and Build FreeTDS

Compile and build FreeTDS as per the example below:

cd /opt/src/freetds-0.91
./configure --prefix=/opt/freetds-0.91
make
make install

NOTE: In order to facilitate administration, you may create a soft link as follows:

cd /opt
ln -s freetds-0.91 freetds

STEP 4: Compile and Build PHP

Compile and build PHP as per the example below:

cd /opt/src/php-5.3.3
./configure --prefix=/opt/php-5.3.3 --with-config-file-path=/opt/php-5.3.3
make
make install

NOTE: In order to facilitate administration, you may create a soft link as follows:

cd /opt
ln -s php-5.3.3 php

STEP 5: Compile and Build the PHP Sybase Extension

PHP requires the sybase_ct extension to allow PHP code to interface with MSSQL. You may compile and build the sybase_ct extension as follows:

cd /opt/src/php-5.3.3/ext/sybase_ct
sh ../../scripts/phpize
./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config --with-sybase-ct=/opt/freetds
make
make install

STEP 6: Enable the PHP Sybase Extension

Enable the sybase_ct extension by adding the following line to /opt/php/php.ini

extension=sybase_ct.so

STEP 7: Verify the PHP (with FreeTDS) Installation

If PHP and the sybase_ct extension have been successfully installed, you should be able to view the sybase_ct module when displaying the PHP configuration information as shown below:

Execute the following command (any user):

php -i | grep sybase_ct

If you see "sybase_ct" in the output, then it means that PHP and the sybase_ct extension have been successfully installed.

NOTE: Since PHP and FreeTDS have been compiled from source and installed in non-standard locations, you must add /opt/php/bin:/opt/freetds/bin to a user’s PATH environment variable.

VN:F [1.6.5_908]
Rating: 0 (from 0 votes)

Problem:

The osad service does not start (RHEL 5.7) and throws the following error:

Starting osad: Unable to load module osad

Background & Analysis:

The osad service is required on all Red Hat Network Satellite clients to receive pushed actions from the RHN Satellite Server. For more details on the osad and related services, please refer this Spacewalk (open-source version of RHN Satellite) article.

Solution:

The osad service depends on the python-hashlibs package.

STEP 1: Install python-hashlibs

Install python-hashlibs as follows:

sudo rpm -ivh <package>

where <package>= the name of the python-hashlibs rpm

Refer the screenshot below:

osad-python-haslib-dep

NOTE: You may also use a "yum install" if python-haslibs is available in any of your your yum repositories.

(1) The solution above describes a successful problem-solving experience and may not be applicable to other problems with similar symptoms.

(2) Your rating of this post will be much appreciated as it gives me and others who read this article, an indication of whether this solution has worked for people other than me. Also, feel free to leave comments.

 

VN:F [1.6.5_908]
Rating: 0 (from 0 votes)

 Page 1 of 27  1  2  3  4  5 » ...  Last »