Showing posts with label System Administration. Show all posts
Showing posts with label System Administration. Show all posts

Wednesday, February 8, 2017

Configuring 2 Gateways on the same Linux Box permanently

Suppose you have 2 network on a PC says
192.168.1.5/24 (eth0 - Private Network)
172.16.10.4/24 (eth1 - Public Network)

Let's assume the 172.16.10.254 is the Default Gateway for 172.16.10.0 network. If there is a router at 192.168.1.254 for the internal network and you wish to connect to other networks says 192.168.5.0 192.168.6.0 and 192.168.7.0 networks. You will need to add "static routes" to these networks

route add -net 192.168.5.0 netmask 255.255.255.0 gw 192.168.1.254
route add -net 192.168.6.0 netmask 255.255.255.0 gw 192.168.1.254
route add -net 192.168.7.0 netmask 255.255.255.0 gw 192.168.1.254


To make the setting permanent, edit /etc/sysconfig/network-scripts/route-eth0
192.168.5.0/24 via 192.168.1.154 dev eth0 
192.168.6.0/24 via 192.168.1.154 dev eth0 
192.168.7.0/24 via 192.168.1.154 dev eth0 

To check the setting is ok
# ip route show

Thursday, October 30, 2014

killing all the processes belonging to a single user

IF you need to kill all the processes belonging to a user, you may want to consider this command which

# pkill -u user

Alternatively, you can log on as the user whom you wish to eliminate his/her jobs, you can use the command. Remember to logon as the person and not as root or you will kill your processes
$ kill -9 -l

Friday, November 9, 2012

Installing and Configuring Environment Modules on CentOS 6

This tutorial is very similar to Installing and Configuring Environment Modules on CentOS 5 and the steps are very similar for CentOS 6 except that the tcl/tk 8.5.x used in CentOS repository does not have tclConfig.sh which is needed when you compile the Modules packages. I used 8.4.x which is similar to the version used in the CentOS 5 repository. You can use more more updated version of tcl.

See Installing and Configuring Environment Modules on CentOS 6.

Further Information
  1. Installing and Configuring Environment Modules on CentOS 5
  2. Usage of Environment Modules on CentOS and in Cluster

Wednesday, November 7, 2012

Usage of Environment Modules on CentOS and in Cluster


This is the 2nd Part continuation of Installing and Configuring Environment Modules on CentOS 5


In the write-up, Usage of Environment Modules on CentOS and in Cluster, Basic Usage of Module commands like module avail, module load, module unload and module switch.

Tuesday, November 6, 2012

Installing and Configuring Environment Modules on CentOS 5

Here a short tutorial on how to install and configure Environmental Modules on CentOS. See
Installing and Configuring Environment Modules on CentOS 5 for more details.
In the short tutorial,  I have document steps how to
  1. Tools of managing User Environment in Linux
  2. Unpacking, Installing and Configure Environment Modules. The Environment Modules Package can be taken from Environment Modules Project
  3. Creating a sample Module File for Intel Compilers

Sunday, November 4, 2012

Tools of managing User Environment in Linux

As far as I know there are 2 tools used to manage the environment.

1. One tool is SoftEnv Manual
  • Softenv is a system used to build the user's environment. Each user has a ".soft" file in which they specify groups of applications that they're interested in. Softenv reads a central database when necessary to update the user's PATH, MANPATH and other variables. This version of SoftEnv is currently being used at MCS. 
  • Current version 1.6.2. The last time it was updated is 12 March 2007
  • Download Site - Sotftenv

2. The other tool is Modules - Software Environment Management
  • The Environment Modules package provides for the dynamic modification of a user's environment via modulefiles.

    Each modulefile contains the information needed to configure the shell for an application. Once the Modules package is initialized, the environment can be modified on a per-module basis using the module command which interprets modulefiles. Typically modulefiles instruct the module command to alter or set shell environment variables such as PATH, MANPATH, etc. modulefiles may be shared by many users on a system and users may have their own collection to supplement or replace the shared modulefiles. 
  • Current Version modules-3.2.9c. The last update was 19th Nov 2011
  • Download Site - Environment Modules

Further Information

Tuesday, September 4, 2012

Adding new LUN dynamically in CentOS

After adding the new LUN(s) from SAN to CentOS Linux,

Step 1: Run the the command “rescan-scsi-bus.sh” , to dynamically detect and activate the new LUN. To understand this utility "rescan-scsi-bus.sh, see Scanning for SCSI new devices dynamically on CentOS

# /usr/bin/rescan-scsi-bus.sh -l

Host adapter 0 (aacraid) found.
Host adapter 1 (ata_piix) found.
Host adapter 2 (ata_piix) found.
Host adapter 3 (qla2xxx) found.
Host adapter 4 (qla2xxx) found.
Scanning SCSI subsystem for new devices
Scanning host 0 for  SCSI target IDs  0 1 2 3 4 5 6 7, LUNs Scanning 
0 1 2 3 4 5 6 7
Scanning for device 0 0 0 0 ...
OLD: Host: scsi0 Channel: 00 Id: 00 Lun: 00
      Vendor: ServeRA  Model: A                Rev: V1.0 
      Type:   Direct-Access                    ANSI SCSI revision: 02
Scanning for device 0 1 0 0 ...
OLD: Host: scsi0 Channel: 01 Id: 00 Lun: 00
      Vendor: IBM-ESXS Model: VPA146C3-ETS10 N Rev: A650
      Type:   Direct-Access                    ANSI SCSI revision: 05
.....
.....
..... 
0 new device(s) found.
0 device(s) removed.
Since LUN are not physical disk, there may not be "new devices" detected, but look at the middle of the information "Scanning host 0 for  SCSI target IDs  0 1 2 3 4 5 6 7, LUNs  0 1 2 3 4 5 6 7"


Step 2: Verify the LUN has been added. You the command lsscsi. If you do not have the utility, do a yum install

# yum install lsscsi

# lsscsi

..... 
.....
[3:0:0:0]    disk    IBM      1814      FAStT  0916  /dev/sdb
[3:0:0:1]    disk    IBM      1814      FAStT  0916  /dev/sdc
[3:0:0:2]    disk    IBM      1814      FAStT  0916  /dev/sdd
[3:0:0:3]    disk    IBM      1814      FAStT  0916  /dev/sde
[3:0:0:4]    disk    IBM      1814      FAStT  0916  /dev/sdf
[3:0:0:5]    disk    IBM      1814      FAStT  0916  /dev/sdg
[3:0:0:6]    disk    IBM      1814      FAStT  0916  /dev/sdn
.....
.....

Alternatively, you can use the command fdisk -l to check whether your LUN is represented in the /dev directory like /dev/sd*
# fdisk -l

.....
.....
Disk /dev/sdr: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdr1               1       65270   524281243+  83  Linux

Disk /dev/sds: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sds1               1       65270   524281243+  83  Linux

Thursday, June 14, 2012

News - Beware of DNS Changer Malware

Information on DNS Changer Malware

  1. Information on DNS Changer Malware, do look at DNS Changer Working Group (CFWG) Website
  2. Check whether your machines are affected or not with the http://www.dns-ok.us/
  3. How to disinfect the DNS Changer Malware with http://www.dcwg.org/fix/
  4. Operation Ghost Click  and additional information from FBI website.
  5. According to FBI website, the clean DNS servers will be turned off on July 9, 2012, and computers still impacted by DNSChanger may lose Internet connectivity at that time


Saturday, January 7, 2012

Understand parameters in /etc/fstab

Do look at the article form "Understand parameters in /etc/fstab" (linuxcluster.wordpress.com). Just a more indepth understanding of /etc/fstab parameters

Thursday, December 1, 2011

Using stunnel to generate to create a self-signed certificate for SL 6 and CentOS 6

 The stunnel Program allows administrator to create self-signed certification using external OpenSSL Libraries included with RHEL and its clone to provide strong cryptography and protect connection. For more information on the installation and setup, see Using stunnel to generate to create a self-signed certificate for SL 6 and CentOS 6

Tuesday, November 8, 2011

Using strace as a troubleshooting tool

Taken from Using strace as a troubleshooting tool (linuxcluster.wordpress.com) Strace, when runs in conjunction with a program do output all the calls made to the kernel by the program.

One of quick way to found out what is going on in your program is to do
$ strace -c ./my_hello_world_program
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
74.80    0.002998        1499         2           wait4
21.91    0.000878           4       221           read
0.95    0.000038           0       237         2 mmap
0.77    0.000031          10         3         1 mkdir
0.67    0.000027           0       566       361 open
0.35    0.000014           0        81           mprotect
0.30    0.000012           0        62        37 stat
0.25    0.000010           0       225           close
0.00    0.000000           0        37         1 write
0.00    0.000000           0       132           fstat
0.00    0.000000           0         8           poll
0.00    0.000000           0         2           lseek
0.00    0.000000           0       120           munmap
0.00    0.000000           0        15           brk
0.00    0.000000           0        16           rt_sigaction
................

................

------ ----------- ----------- --------- --------- ----------------
100.00    0.004008                  1990       411 total

If you wish to do a tracing, just do a, you can easily find out the error if there was....
$ strace ./my_hello_world_program
............

............

open("/tmp/openmpi-sessions-root@starfruit-h00.cluster.spms.ntu.edu.sg_0/25979/1/0",
O_RDONLY|O_NONBLOCK|O_DIRECTORY) = -1 ENOENT (No such file or directory)
munmap(0x2b46e05ef000, 2111200)         = 0
munmap(0x2b46dffe5000, 2102312)         = 0
munmap(0x2b46dfdde000, 2123264)         = 0
munmap(0x2b46e103f000, 2106960)         = 0
munmap(0x2b46e1242000, 2104560)         = 0
munmap(0x2b46e269d000, 2114912)         = 0
munmap(0x2b46e41c9000, 2145008)         = 0
munmap(0x2b46e43d5000, 2162608)         = 0

If you wish the output of strace to a file instead, do use the argument -o
$ strace -o strace_output_file ./my_hello_world_program

If you wish to trace system call, process,network, you can use the "-e trace=file", "-e trace=process", "-e trace=network",
$ strace -e trace=open,close,read,write ./my_hello_w0rld_program
$ strace -e trace=stat,chmod,unlink ./my_hello_world_program
Further Information:
  1. Solutions for tracing UNIX applications (IBM DeveloperWorks)
  2. strace - A very powerful troubleshooting tool for all Linux users (linuxhelp.blogspot.com)
  3. Ten commands every linux developer should know (Linux Journal)

Monday, July 18, 2011

Basic Kickstart on CentOS 5

A simple readable tutorial from my other blog (Linux Cluster) on how to configure Redhat / CentOS kickstart to create another copy of your configuration on the next server

  1. Basic Kickstart on CentOS 5 (Part 1)
  2. Basic Kickstart on CentOS 5 (Part 2)

Happy reading.... :)

Wednesday, February 16, 2011

Centrify Express Express Tips and Tricks


Centrify Express provides a couple of good links to provide some quick-start to configure Linux Box to talk to the MS AD
  1. For Best Practise Video, see Centrify Express Tips and Tricks
  2. For the  community site including forum see Centrify Express Community Site

Thursday, January 20, 2011

Using Gnome Partition Editor (Gparted) to resize, move the partition Windows NTFS

GParted is a free partition editor for graphically managing your disk partitions. The latest stable version of GParted is able to handle comfortably the following file systems. See Gpart -- Features. Please check before you use Gparted.

I have used the Gparted to shrink my D drive, and expand the "C" Drive on a Windows 7. I was pleasantly surprised that after dhrinking my D drive, I can move "D" Drive to the "free space" and  create "free" space on the right of the C Drive. And all this is done with simple clicked, drag and drop.

Indeed a wonderful tool for System Administration

Sunday, March 7, 2010

Directory index forbidden by Options directive error for when displaying nagios

When you are unable to display the Nagios web after installation but encounter "Directory index forbidden by Options directive: .........." error. You need to set Apache to serve the file when the directory is requested.

To resolve the problem above. Go to
# vim /etc/httpd/conf/httpd.conf

Type the following into http.conf and restart apache and nagios


# service htpd restart
# service nagios restart

Sunday, December 13, 2009

Fixing your system with FirstAidKit

Since Fedora 10, FirstAidKit package has been included in the Fedora Distribution. Basically, Firstaidkit is an automated recovery tool that brings together common recovery processes and applies them to a system. It is built on top of a pluggable architecture.

  1. To install FirstAidKit
    # yum install firstaidkit
  2. To run the automated process of the recovery tool, run
    # firstaidkit -a
  3. To view a list of available plug-ins
    # firstaidkit --list
For more information on FirstAidKit, see First Aid Kit by Fedora

Saturday, December 12, 2009

Tips on useradd and usermod commands

Today it is back to the basis again.

useradd and usermod are very often used utilities. They are several useful paramenters which we can use for the creation and maintenance of user accounts.

  • -c (Comments and Descriptions of the account. Using quotation is necessary if you are using multiple words
  • -d (home directory of the account. If -m is used, copy the home directory as well)
  • -e (Assign a expiration date for the account in MM/DD/YYYY format)
  • -f (Set the number of days after a password expires until the account is permanently disabled. The default option is -l which disable this option)
  • -g (primary group that the account belongs to)
  • -G (list of groups that user belongs to)
  • -l (Change login name of the account to the name supplied after -l option)
  • -u (Change the userid for the account) 

Saturday, September 12, 2009

Using id commands to display user and group information

Learned a simple but effective commands today to display user and group information. That is "id"

# id your_userid

Friday, September 11, 2009

Setting Quota on CentOS Linux

Setting up Disk Quota on CentOS 5.x or Linux is rather straightforward. I'm assuming you are setting on a partition /dev/sdb1


Step 1: At the /etc/fstab, add "usrquota, grpquota" to the partition you wish to put quota on
/dev/sdb1 /home ext3 defaults,usrquota,grpquota 1 1


Step 2: Initialise aquota.user
# touch /dev/sdb1/aquota.user
# chmod 600 /dev/sdb1/aquota.user

Step 3: Remount the partition
# mount -o remount /dev/sdb1
# less /etc/mtab
(It should show
the list of file system having quota entry in Step 1)

Step 4: Do a Quotacheck commands and turn the quota on
#quotacheck -avugm /dev/sdb1
(The quotacheck command will do a scan and will take a while)
# quotaon -av
# quotatstats
(Check for statistics and possible error encountered)

Step 5: To edit a quota
# edquota -u user_id
(Edit the soft and hard limit respecitvely) or alternatively
# setquota -u user_id 100 200 0 0 -a /dev/sdb1
(where 100 and 200 are the block soft and hard limit respectively)


To quota summary report, do a repquota
# repoquota -a

Further Notes:
For more details readings,

Saturday, July 18, 2009

Power Mangement for KDE and Gnome



Gnome Power Mangement is a essential tool for power mangement on notebook and desktop. It has interesting options such as
  1. To suspend your laptop when the lid is closed.
  2. Power History (my favourite)
  3. Display Brightness
  4. Actions taken when power buttons or suspend buttons is pressed
  5. And so much more.....
It comes with Installation....of Linux Mint and Ubuntu



KDE Power Devil is a lightweight laptop power management system designed for KDE4 Environment. According to the site, with PowerDevil you can set up preferences for lid Closing, Brightness, CPU scaling, Idle time, both when connected to AC and when on Battery.

Good news! KDE Power Devil is now compiled with KDE Core Releases and no longer as an external application