Monday, August 27, 2012

Mount a linux server dir to another linux server directory


Say we have 2 servers named as
server1                 (192.168.1.45)
server2                 (192.168.1170)

we want to mount a directory of 192.168.1.45 on the .170 server

Step1.
install nfs server on server1 (.45)
#yum install nfs-utils nfs4-acl-tools portmap
#chkconfig nfs on

Step2.
Share the directory on server1(.45)
#vim /etc/exports
/image1 192.168.1.170(rw)
save the file {it will give server2 (.170) read write access}
# exportfs -avr

Step3.
Mounting the /image1 directory on the server2
you need to create a directory on server2 where you want to mount the directory from server1
#mkdir /image1

#vim /etc/fstab
192.168.1.45:/image1     /image1 nfs hard,intr 0 0
save and close the  file

#mount -t nfs -a

the above command will mount the server1 shared directory to the server2 directory(/image1).

Saturday, August 4, 2012

How to Disable ndr's in sendmail


 vi /etc/mail/sendmail.mc

Change the below line
dnl # define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
  TO
define(`confPRIVACY_FLAGS', `authwarnings,nobodyreturn')dnl

save and exit

Restart the Sendmail


Remove directory from CVS



CVS doesn't really keep directories under version control. If you want to remove a directory from a project, you first remove all the files in it, then use update -P to remove the directory from the working directory.

CVS checkout and update will always check out empty directories; that's just the way CVS is built. Do an update with "-P" -- "prune" -- to remove empty directories:

cvs update -dP

(Adding "-d" will update new directories that have appeared since your last update; otherwise, CVS will ignore them.)

Cvs tends to work on a two phase approach regarding directories that's why there is a -P option for many cvs commands to "Prune empty directories".

When this has happened, e.g. want to rename a directory I've just added, I delete the directory, delete the entry for the directory in the CVS/Entries file, it'll be a line perpended with a "D".

If I've committed, I make sure my current working area that contains the empty directory/ies is all checked in. Then I blow away the part of the work area that I have added the directories to.
Ex.

/mySandbox/Project_to_remove/etc_etc
/mySandbox/Project_to_remove/emptyDir


I make sure everything is up to date in both directories containing the stuff I want to keep. I then blow away Project_to_remove from within mySandbox.
Going back and checking out the same work area, e.g. Project_to_remove will give me the work area without the empty dirs.
Or just leave everything as is and use the -P option to get CVS check everything out (or update everything) then prune out the empty dirs.

Renaming Directories

checkout the project, make the changes on the local working copy, delete the CVS project in the repository and import the changed project again.



Redirect HTTPS TO HTTP

URL Rewriting


open your httpd.conf file and put the lines below.
-----------------------------------------------------------------
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R,L]
-----------------------------------------------------------------

Apache have a good document for this.

http://httpd.apache.org/docs/2.2/misc/rewriteguide.html
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html


How to Mount Windows Share with CentOS

1. Install below package
#yum install samba-client
#yum install cifs-utils
2. create a file to keep/save you windows password in that. (you can also pass them directly on shell)
cd /home/nk
vim secret.txt
username=Domain\windowsUsername
password=YourPassowrForWindowsDomain

save and exit by :wq

4. make a directory where you want to mount the windows share folder
mkdir /mnt/nk

5.pass the below command to mount the windows shared folder to Centos folder
mount -t cifs //192.168.1.14/share /mnt/nk/ -o credentials=/home/nk/secret.txt

here : 192.168.1.14 is the windows machine IP
           "share" is the name of the folder you want to share(make sure you have access to this)

6. check that folder is mounted by "mount" command

Or
 mount -t cifs //192.168.1.14/share /mnt/nk/ -o -o username=#####,password=######
 
If the machine is in domain
mount -t cifs //192.168.1.14/share /mnt/nk/ -o -o username=DomainName/xxxx,password=xxxx



Tuesday, July 31, 2012

GUI for CentOS 6.2 minimal install Edition

yum groupinstall "Desktop" "Desktop Platform" "X Window System" "Fonts"
yum groupinstall basic-desktop desktop-platform x11 fonts 

Once the minimal installation is done & then you are installing the 
Deskstop Packages changing Default runlevel from 3 to 5 does not start 
Xorg for GUI hence we need to add “exec /etc/X11/prefdm -nodaemon” in 
/etc/inittab file.
 

Thursday, July 12, 2012

base.bind.h ealing Lost connection to xxxt(GC). Running in disconnec ted mode: unlatch

Jul 12 19:14:52 pimage1-rl adclient[1986]: INFO  base.bind.h
ealing Lost connection to xxxt(GC). Running in disconnec
ted mode: unlatch
Jul 12 19:14:52 pimage1-rl adclient[1986]: INFO  base.bind.h
ealing Reconnected to xxxxxxxxxxt(GC).  Running in connected
mode.
Jul 12 19:45:22 pimage1-rl adclient[1986]: INFO  base.bind.h
ealing Lost connection to xxxxxxxxxx(GC). Running in disconn
ected mode: unlatch
Jul 12 19:45:22 pimage1-rl adclient[1986]: INFO  base.bind.h
ealing Reconnected to xxxxxxxxxx(GC).  Running in connected mo
de.





"adreload" and even "centrifydc restart"

In ADUC, right click on the Computer object, select "Reset Account"

On client side:

Run the command "adkeytab -C" or "adkeytab -r" as root


restart adclient one more time. If it still continues to be in disconnected mode,  "adinfo -g " check the output for examination. 

Friday, July 6, 2012

mysql question


>how much the expected data base size would be
>what/what kind of application is going to deploy
> connection type b/n application & data base (is application using connection pool etc etc)
>Security of data base (users in database eg. root pwd secure in database & connect only thru localhost)
>What mysql table engine preferred (myISAM or Innodb ) ==> how is our applicaiton (e.g if more insert and select then go with myISAM
and if more update and select then go with innodb
and if more insert + delete + select then go with innodb
and if one time bulk insert + one time delete + select then myisam
>reason               myisam -- lock table level
innodb -- locks table in row level
If databases have majority of innodb table then
setup server with following parameter
innodb_buffer_size s/b 65-75 % of available RAM and so on
>Before that I need to know the config of the system

                - RAM
                - What processor
                - What media (SATA or SAS or SSD)

Wednesday, July 4, 2012

How to delete all the root mail in linux by mutt + root mailbox full or 5.2.2: Permanent Failure: Mailbox Status: Mailbox full

How to delete all the root mail in linux by mutt

#mutt
/root/Mail does not exist. Create it? ([yes]/no):
yes

Then press "D"
At the bottom it asks "Delete messages matching:"
 ~s .*

-*-Mutt: /var/spool/mail/root [Msgs:46339 New:46339 Del:46339 48M]---(date/date)-

press "q" to quit and "y" to confirm

Monday, July 2, 2012

Too many files open

No. of Open Files
# lsof | wc -l

[root@aqua ~]# sysctl fs.file-max
fs.file-max = 10000
[root@aqua ~]# sysctl fs.file-max
fs.file-max = 10000

File Descriptor in Kernal memory
[root@aqua ~]# sysctl fs.file-nr
fs.file-nr = 2928       0       10000

a. 2828 is no. of allocated file handles
b. 0 no. of unused but alloted handles
c. 10000 system wide maximum number of file handles

No. of file handles used by a process xxx
#lsof -p xxx|wc -l
 
=================
Too Many files open

use lsof command
ps aux
ps aux | grep jetty
lsof -p 1105
lsof -p 1105 | wc -l
ll /proc/11105/fd
ll /proc/1105/fd | sort -g +10 -10

To sort by the Name column
lsof -p 1105 | sort +10 -10 >/tmp/openFiles.txt

The FD column is the File Descriptor column. It is either the number of the file or one of the following:

    cwd current working directory
    Lnn library references (AIX)
    err FD information error (see NAME column)
    jld jail directory (FreeBSD)
    ltx shared library text (code and data)
    Mxx hex memory-mapped type number xx
    m86 DOS Merge mapped file
    mem memory-mapped file
    mmap memory-mapped device
    pd parent directory
    rtd root directory
    tr kernel trace file (OpenBSD)
    txt program text (code and data)
    v86 VP/ix mapped file

Determine the limit

Each user has a limit for the number of open files. This limit applies to each process run by the user. For example say the limit is 1024 and the user has three processes running, each process can open 1024 files for a total of 3072.

To determine the soft limit:
ulimit -Sn
1024

To determine the hard limit:
ulimit -Hn
2048

ulimit -n shows you the soft limit. The soft limit is the limit applied for opening files. The hard limit is the limit you can increase the soft limit to.

Increase the Limit

To increase the limit to 10000 use the following command:

ulimit -Sn 10000

You can change the hard limit too, ulimit -Hn 10000. ulimit -n 10000 changes both the soft and hard limits to the same value.

Note: Once you reboot the limit is reset.
You cannot determine the limit of the root user using ulimit. For example:

sudo ulimit -n
sudo: ulimit: command not found
To make the limits bigger and to make the change permanent, edit your configuration file and reboot.

You can use * in the limit.conf file instead of a user name to specify all users, however this does not apply to the root!

    soft nofile 10000
    hard nofile 10000
    
    The limit.conf file is applied during the boot process. 
    
    
    You cannot start a process late enough in the boot process! For example: “sudo update-rc.d tomcat defaults 99 01″ is at the end and it is still too late.

The work around is to force the limit to be set before starting the process. Put “ulimit -n 4000″ before starting your process, then the limit.conf file is processed here.

There is another file limit in the system, the total number of files that can be opened by all processes.

To see the file max value:
sysctl -a | grep fs.file-max
fs.file-max = 170469 
  
 
File descriptor can be limited in both system level and shell level.
 
To check maximum number of fd in system type 'cat /proc/sys/fs/file-max'.
730437
 
If u want to set it add 'fs.file-max = 200000' to /etc/sysctl.conf
 
 
To check shell level limit
 
Shell level 'ulimit -n' 

1024

In /etc/security/limits.conf
* soft nofile 2048
* hard nofile 2048
 
 
To get total number of handle that a process use
 
lsof -p PID |wc -l
 
 
For File Descriptors == >  Easy way to edit the file
 
echo "#### Custom Addedlines ####">> /etc/security/limits.conf 
echo "* soft nofile 32768" | sudo tee -a /etc/security/limits.conf
echo "* hard nofile 32768" | sudo tee -a /etc/security/limits.conf
echo "root soft nofile 32768" | sudo tee -a /etc/security/limits.conf
echo "root hard nofile 32768" | sudo tee -a /etc/security/limits.conf
 
 
For User limits  == > 

* soft nofile 32768
* hard nofile 32768
root soft nofile 32768
root hard nofile 32768
* soft memlock unlimited
* hard memlock unlimited
root soft memlock unlimited
root hard memlock unlimited
* soft as unlimited
* hard as unlimited
root soft as unlimited
root hard as unlimited
 
 
In addition, you may need to be run the following command:
sysctl -w vm.max_map_count=131072
The command enables more mapping. It is not in the limits.conf file.



Disable Swap

Disable swap entirely. This prevents the Java Virtual Machine (JVM) from responding poorly because it is buried in swap and ensures that the OS OutOfMemory (OOM) killer does not kill


sudo swapoff --all

 
 
OR
 
echo "*   soft    nofile  131070" >> /etc/security/limits.conf
echo "*   hard    nofile  131070" >> /etc/security/limits.conf

echo 0 > /proc/sys/vm/swappiness
echo "vm.swappiness=0" >> /etc/sysctl.conf


Note
Both the “hard” and the “soft” ulimit affect MongoDB’s performance. The “hard” ulimit refers to the maximum number of processes that a user can have active at any time. This is the ceiling: no non-root process can increase the “hard” ulimit. In contrast, the “soft” ulimit is the limit that is actually enforced for a session or process, but any process can increase it up to “hard” ulimit maximum.
A low “soft” ulimit can cause can't create new thread, closing connection errors if the number of connections grows too high. For this reason, it is extremely important to set both ulimit values to the recommended values
 
 OR
sudo vim /etc/security/limits.conf

*           soft    nofile         10000
*           hard    nofile         20000
Modify the common-session file with the following: sudo vim /etc/pam.d/common-session
session required pam_limits.so
==
you can set system wide limits by editing /etc/security/limits.conf and /etc/pam.d/common-session, however, this only applies interactive and non-interactive shells (and processes started by them).
If you want to try system wide limits, then add a line like the following to /etc/security/limits.conf:
*  -  nofile 65000

In /etc/pam.d/common-session, enable the limits module by adding:
session required pam_limits.so

Keep in mind that all this really does is have PAM set the limit for 
interactive and non-interactive shells when loaded. Processes then 
pickup these limits when started from shells/scripts. You should 
probably do a restart to fully enact these settings. 


and reboot the system.

The option with wildcard *didn’t work for me , because I used root accout to run my programms and wildcard option doesn’t affect the superuser.

 
 

Sunday, July 1, 2012

CentOS 6.2 + Qpidd

When CentOS 6.2 is installed in GUI mode then it install Qpidd by default.


Tasks: 700 total,   5 running, 695 sleeping,   0 stopped,   0 zombie
Cpu(s): 12.2%us, 19.5%sy,  0.0%ni, 67.3%id,  0.0%wa,  0.0%hi,  1.1%si,  0.0%st
Mem:  32866212k total,  5185096k used, 27681116k free,   365688k buffers
Swap: 33554424k total,        0k used, 33554424k free,  3212884k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 4358 root      20   0 4428m  68m  10m S 338.7  0.2   6291:59 dsm_om_connsvcd
 3310 root      20   0 5574m 885m  10m S 146.8  2.8   3095:24 java
 3259 root      20   0  113m 8316 4612 S 99.8  0.0   3155:52 java
 3554 qpidd     20   0 1960m  12m 3108 S 23.5  0.0 620:13.01 qpidd


# rpm -qa | grep qpid
qpid-cpp-server-0.14-14.el6_2.x86_64
qpid-cpp-client-0.14-14.el6_2.x86_64
qpid-cpp-client-ssl-0.14-14.el6_2.x86_64
qpid-qmf-0.14-7.el6_2.x86_64
qpid-cpp-server-ssl-0.14-14.el6_2.x86_64

It has dependecy on

Dependencies Resolved

===========================================================================================================================================
 Package                                 Arch                       Version                             Repository                    Size
===========================================================================================================================================
Removing:
 qpid-cpp-client                         x86_64                     0.14-14.el6_2                       @updates                     4.0 M
 qpid-cpp-client-ssl                     x86_64                     0.14-14.el6_2                       @updates                     341 k
 qpid-cpp-server                         x86_64                     0.14-14.el6_2                       @updates                     3.3 M
 qpid-cpp-server-ssl                     x86_64                     0.14-14.el6_2                       @updates                     147 k
 qpid-qmf                                x86_64                     0.14-7.el6_2                        @updates                     1.4 M
Removing for dependencies:
 matahari                                x86_64                     0.4.4-12.el6_2                      @updates                      18 k
 matahari-agent-lib                      x86_64                     0.4.4-12.el6_2                      @updates                      81 k
 matahari-broker                         x86_64                     0.4.4-12.el6_2                      @updates                      32 k
 matahari-host                           x86_64                     0.4.4-12.el6_2                      @updates                     102 k
 matahari-network                        x86_64                     0.4.4-12.el6_2                      @updates                      72 k
 matahari-service                        x86_64                     0.4.4-12.el6_2                      @updates                     126 k
 matahari-sysconfig                      x86_64                     0.4.4-12.el6_2                      @updates                      54 k

Transaction Summary
===========================================================================================================================================
Remove       12 Package(s)


[root@imonitor etc]# rpm -qa | grep matahari
matahari-broker-0.4.4-12.el6_2.x86_64
matahari-0.4.4-12.el6_2.x86_64
matahari-network-0.4.4-12.el6_2.x86_64
matahari-sysconfig-0.4.4-12.el6_2.x86_64
matahari-lib-0.4.4-12.el6_2.x86_64
matahari-host-0.4.4-12.el6_2.x86_64
matahari-service-0.4.4-12.el6_2.x86_64
matahari-agent-lib-0.4.4-12.el6_2.x86_64

To stop it use
# /etc/init.d/qpidd stop

To Remove it & its dependency completely

#yum remove qpid-*

Running Transaction
  Erasing    : matahari-0.4.4-12.el6_2.x86_64                                                                                         1/12
  Erasing    : matahari-broker-0.4.4-12.el6_2.x86_64                                                                                  2/12
  Erasing    : qpid-cpp-server-ssl-0.14-14.el6_2.x86_64                                                                               3/12
  Erasing    : matahari-host-0.4.4-12.el6_2.x86_64                                                                                    4/12
  Erasing    : matahari-network-0.4.4-12.el6_2.x86_64                                                                                 5/12
  Erasing    : matahari-service-0.4.4-12.el6_2.x86_64                                                                                 6/12
  Erasing    : matahari-sysconfig-0.4.4-12.el6_2.x86_64                                                                               7/12
  Erasing    : matahari-agent-lib-0.4.4-12.el6_2.x86_64                                                                               8/12
  Erasing    : qpid-qmf-0.14-7.el6_2.x86_64                                                                                           9/12
  Erasing    : qpid-cpp-client-ssl-0.14-14.el6_2.x86_64                                                                              10/12
  Erasing    : qpid-cpp-server-0.14-14.el6_2.x86_64                                                                                  11/12
  Erasing    : qpid-cpp-client-0.14-14.el6_2.x86_64                                                                                  12/12

Removed:
  qpid-cpp-client.x86_64 0:0.14-14.el6_2         qpid-cpp-client-ssl.x86_64 0:0.14-14.el6_2     qpid-cpp-server.x86_64 0:0.14-14.el6_2
  qpid-cpp-server-ssl.x86_64 0:0.14-14.el6_2     qpid-qmf.x86_64 0:0.14-7.el6_2

Dependency Removed:
  matahari.x86_64 0:0.4.4-12.el6_2              matahari-agent-lib.x86_64 0:0.4.4-12.el6_2    matahari-broker.x86_64 0:0.4.4-12.el6_2
  matahari-host.x86_64 0:0.4.4-12.el6_2         matahari-network.x86_64 0:0.4.4-12.el6_2      matahari-service.x86_64 0:0.4.4-12.el6_2
  matahari-sysconfig.x86_64 0:0.4.4-12.el6_2


or

#yum erase matahari-lib matahari-agent-lib matahari-broker matahari-host matahari-service matahari-sysconfig matahari-network matahari qpid-cpp-client qpid-cpp-client-ssl qpid-cpp-server-ssl qpid-cpp-server sigar polkit dbus qpid-qmf boost ConsoleKit eggdbus boost-filesystem boost-program-options boost-graph boost-date-time boost-serialization boost-test boost-thread boost-regex boost-wave  boost-signals boost-iostreams boost-python ConsoleKit-libs libicu



Thursday, June 28, 2012

How to kill thousands of rogue process in linux by single command

In my case there was a dstat process which was scheduled by cron went viral and due to this the system start throwing the error as


Jun 28 09:49:01 machine kernel: VFS: file-max limit 10000 reached
Jun 28 09:49:01 machine kernel: VFS: file-max limit 10000 reached
Jun 28 09:50:01 machine  kernel: VFS: file-max limit 10000 reached
Jun 28 09:50:01 machine  kernel: VFS: file-max limit 10000 reached

By login as root and running the below command you can get the no if times it run with PID.
now it will be very time consuming if you kill each pid one by one.
better approach

# ps -ef | grep dstat | grep -v grep | awk '{print $2}'

then pass the command to the kill -9  and it will kill all the PID related to this process.
# kill -9 `ps -ef | grep dstat | grep -v grep | awk '{print $2}'`

 

Friday, June 22, 2012

Disk I/O monitoring on linux (iostat/sar)


# iostat -dkx 30
 
On every Linux box the following should be graphed at 5 minute averages
  • %util: When this figure is consistently approaching above 80% you will need to take any of the following actions -
    • increasing RAM so dependence on disk reduces
    • increasing RAID controller cache so disk dependence decreases
    • increasing number of disks so disk throughput increases (more spindles working parallely)
    • horizontal partitioning
  • (await-svctim)/await*100: The percentage of time that IO operations spent waiting in queue in comparison to actually being serviced. If this figure goes above 50% then each IO request is spending more time waiting in queue than being processed. If this ratio skews heavily upwards (in the >75% range) you know that your disk subsystem is not being able to keep up with the IO requests and most IO requests are spending a lot of time waiting in queue. In this scenario you will again need to take any of the actions above
  • %iowait: This number shows the % of time the CPU is wasting in waiting for IO. A part of this number can result from network IO, which can be avoided by using an Async IO library.

Wednesday, June 20, 2012

Install PHP-Mcrypt on CentOS 6.2


# rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
#yum install php-mcrypt

Restart httpd
#service httpd restart

Monday, June 18, 2012

Monitor CPU Temperature on Linux (CentOS/RHEL)


lm_sensor is a tool that can monitor linux hardware - works great with 2.6 + kernel onwards
install
#yum install lm_sensors

Configure
#sensors-detect

Press YES to all prompt 

Output depend on your type of MB
=====================

Now follows a summary of the probes I have just done.
Just press ENTER to continue:

Driver `w83627ehf':
  * ISA bus, address 0xa10
    Chip `Winbond W83627DHG-P Super IO Sensors' (confidence: 9)

Driver `sbs':
  * Bus `i915 gmbus reserved'
    Busdriver `drm', I2C address 0x0b
    Chip `Smart Battery' (confidence: 5)

Do you want to overwrite /etc/sysconfig/lm_sensors? (YES/no):
Starting lm_sensors: loading module sbs w83627ehf          [  OK  ]
Unloading i2c-dev... OK
==============================

Instead of system restart - load the module (if any)by modprobe command 

#modprobe i2d-dev

you can check the modules as
# cat /etc/sysconfig/lm_sensors


Run the command to check the cpu current temperature & high/critical limit

[root@imonitor tmp]# sensors
coretemp-isa-0000
Adapter: ISA adapter
Core 0:      +23.0°C  (high = +89.0°C, crit = +105.0°C)   >> here +23 deg C is the current Temp
Core 2:      +18.0°C  (high = +89.0°C, crit = +105.0°C)

w83627dhg-isa-0a10
Adapter: ISA adapter
Vcore:       +0.90 V  (min =  +0.00 V, max =  +1.74 V)
in1:         +0.78 V  (min =  +1.27 V, max =  +0.52 V)   ALARM
AVCC:        +3.39 V  (min =  +2.98 V, max =  +3.63 V)
VCC:         +3.39 V  (min =  +2.98 V, max =  +3.63 V)
in4:         +1.30 V  (min =  +0.93 V, max =  +1.48 V)
in5:         +0.77 V  (min =  +0.06 V, max =  +0.64 V)   ALARM
in6:         +1.06 V  (min =  +0.01 V, max =  +0.03 V)   ALARM
3VSB:        +3.36 V  (min =  +2.98 V, max =  +3.63 V)
Vbat:        +3.34 V  (min =  +2.70 V, max =  +3.30 V)   ALARM
fan1:          0 RPM  (min = 112500 RPM, div = 4)  ALARM
fan2:          0 RPM  (min = 3924 RPM, div = 4)  ALARM
fan3:          0 RPM  (min = 337500 RPM, div = 4)  ALARM
fan5:          0 RPM  (min = 13775 RPM, div = 2)  ALARM
temp1:       +24.0°C  (high = -68.0°C, hyst = -123.0°C)  ALARM  sensor = diode
temp2:       +23.0°C  (high = +80.0°C, hyst = +75.0°C)  sensor = diode
temp3:      +127.0°C  (high = +80.0°C, hyst = +75.0°C)  ALARM  sensor = thermistor
cpu0_vid:   +2.050 V

if you want to see the temperature in Fahrenheit then 
#sensors -F

if you want to monitor it live then use the below command

#watch 'sensors | grep "core''


Reading


Sunday, June 17, 2012

Ftp Access to /var/www/html for website editing [CentOS/RHEL + Vsftpd]

1. Create a group for website users , say webgroup   # groupadd webgroup
2. give them proper permissions  : chown -R root:webgroup /var/www/html
3.chmod g+s  /var/www/html    {this will help if a user "x" creates a file/dir then it will be owned by him , so set a SETGID bit to the parent directory so that any new file by default have group id as webgroup}
4. chmod 770 /var/www/html
5. usermod -aG webgroup apache


How to Set VSFTPD

#yum install vsftpd
# service vsftpd start
#chkconfig vsftpd on
# netstat -a | grep ftp


Contents of vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=002
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
ftpd_banner=Hello world
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
pam_service_name=vsftpd
userlist_enable=YES
listen=YES
tcp_wrappers=YES


Contents of vsftpd.chroot_list

webftpuser


contents of : cat /etc/pam.d/vsftpd
#%PAM-1.0
auth       required     pam_listfile.so item=user sense=deny file=/etc/vsftpd.ftpusers onerr=succeed
auth       required     pam_stack.so service=system-auth
auth       required     pam_shells.so
account    required     pam_stack.so service=system-auth
session    required     pam_stack.so service=system-auth






Friday, June 15, 2012

Monitor per core CPU utilization in Linux (CentOS/RHEL)

1. Run Top  and press numeric 1 to get core wise CUP utilization
#top
1

Other tags

 Z,B       Global: 'Z' change color mappings; 'B' disable/enable bold
  l,t,m     Toggle Summaries: 'l' load avg; 't' task/cpu stats; 'm' mem info
  1,I       Toggle SMP view: '1' single/separate states; 'I' Irix/Solaris mode

  f,o     . Fields/Columns: 'f' add or remove; 'o' change display order
  F or O  . Select sort field
  <,>     . Move sort field: '<' next col left; '>' next col right
  R,H     . Toggle: 'R' normal/reverse sort; 'H' show threads
  c,i,S   . Toggle: 'c' cmd name/line; 'i' idle tasks; 'S' cumulative time
  x,y     . Toggle highlights: 'x' sort field; 'y' running tasks
  z,b     . Toggle: 'z' color/mono; 'b' bold/reverse (only if 'x' or 'y')
  u       . Show specific user only
  n or #  . Set maximum tasks displayed

  k,r       Manipulate tasks: 'k' kill; 'r' renice
  d or s    Set update interval
  W         Write configuration file
  q         Quit

2. Use Sar

#Sar -A

 

Thursday, June 14, 2012

sosreport in CentOS and RHEL >> ‘Generate debugging information for this system

# yum install sos

sosreport” will generate a compressed a bz2 file under /tmp.

# /usr/sbin/sosreport

sosreport (version 2.2)

This utility will collect some detailed  information about the
hardware and setup of your Red Hat Enterprise Linux system.
The information is collected and an archive is  packaged under
/tmp, which you can send to a support representative.
Red Hat Enterprise Linux will use this information for diagnostic purposes ONLY
and it will be considered confidential information.

This process may take a while to complete.
No changes will be made to your system.

Press ENTER to continue, or CTRL-C to quit.
 


Press Enter

Please enter your first initial and last name [sapp1-rl]: Mr Aqua
 

Please enter the case number that you are generating this report for:dummy


  Running plugins. Please wait ...

  Completed [53/53] ...
Creating compressed archive...

 

Your sosreport has been generated and saved in:
  /tmp/sosreport-MrAqua-20120614230734-28d7.tar.xz

The md5sum is: ffc2e235390412ccade7e4a1e50428d7

Please send this file to your support representative.

You have mail in /var/spool/mail/root
 


It contains linux configuration files/all startup/shutdown scripts, all kind of current system information (dmidecode, lsmod, lspci, netstat, iptables, rpm, network routes

Thursday, June 7, 2012

passwd: Authentication token manipulation error + CentOS


if you see this error then just run the "pwconv" from root prompt as shown in the example and  you will be all set.

[root@aqua ~]# passwd myuser
Changing password for user myuser.
passwd: Authentication token manipulation error
[root@aqua ~]# pwconv
[root@aqua ~]# passwd myuser
Changing password for user myuser.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@aqua ~]#