Saturday 6 July 2013

How to changes all account mail quota on ZImbra

For single account

- You need to login as zimbra user

 #su zimbra

- then find out how musch  is your account quota

$ zmprov ga test@test.com | grep zimbraMailQuota
zimbraMailQuota: 104857600


104857600 is bytes it is comes from 1 MB = 1024 1 kb = 1024 byte So
100 MB = 1024 * 1024 * 100 = 104857600 Bytes to changes the quota from 100 mb to 1 gb

$ zmprov ma test@test.com zimbraMailQuota 1048576000

now checked it

$ zmprov ga test@test.com | grep zimbraMailQuota
zimbraMailQuota: 1048576000



For all user account
We can also changes all of the mail account quota or even length of password on Class of service (CoS), and this time it is easier to use zimbra admin gui, go to your zimbra admin gui at http://yourzimbraaddress.com:7071 and login with your username and password
go to Class of service option on the left side

 you will see kind of cos there , by default there are only default cos

You can create or copy another cos then assigned the user to use your new cos. , go to Accounts -> clicked the account / edit -> look om the General Information -> Account Setup -> Class of service:

Back to COS setting, after we clicked default. It should show this
go to advanced to set the mail account quota, there are other option that you can set also such as
- Attachment Settings
- Password
- Failed Login Policy
- Timeout Policy
- Email Retention Policy


Now all of your account under COS : default quota has been changes

Wednesday 3 July 2013

TO CHANGE TIME ZONE IN LINUX

How to change Date, Time , Zone on linux server?


# date
Tue May 11 22:27:44 CET 2010

Set Date:
Use the following syntax to set new data and time:


Refer the below example :-

#date -s “23 June 2013 18:00:00″

Set Time:

To set time use the following syntax:

# date +%T -s “05:10:15″
Where,
* 05: Hour (hh)
* 10: Minute (mm)
* 15: Second (ss)

To change timezone

The file /etc /localtime, is copy of a file which has details about your time zone. The Zone information file is located at /usr/share/zoneinfo and this depends on your distribution.


#cd /etc/
#ln -sf /usr/share/zoneinfo/EST localtime



If you wish to set up  to IST (Asia/Calcutta):

#ln -sf /usr/share/zoneinfo/Asia/Calcutta localtime

Monday 1 July 2013

How to Check POP3 and IMAP service.

Checking Service Availability

Log in to your server over SSH and input the following commands:

Test POP3

telnet localhost 110

Test IMAP

telnet localhost 143

If your POP3/IMAP services are running, you will see responses similar to the following:

POP3

Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
+OK Hello there

IMAP

Trying 127.0.0.1...
 Connected to localhost.localdomain (127.0.0.1).
 Escape character is '^]'.
 * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2004 Double Precision Inc. See COPYING for distribution information.

Testing login capability

You can perform a login attempt over telnet to these services quite easily.

POP3

Upon making the initial conneciton attempt, you should get the +OK Hello There message. Now do the following:
 
user username@example.com
+OK Password required.
pass PASSWORD
+OK logged in.
list
+OK POP3 clients that break here, they violate STD53.
 
TIP:
The +OK messages in between commands are server responses.

IMAP

Upon making the initial connection attempt, you should get the * OK [CAPABILITY IMAP4rev1...] message. Now do the following:
 
01 login username@example.com <password>

You should get the following response from the server:
 
01 OK LOGIN Ok.

Troubleshooting

If you make a connection attempt through either port 110(POP3) or 143(IMAP) and get a response similar to the following:
 
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host: Connection refused

This is an indication that the Courier-IMAP service is not running.
First, check if courier-imap is running:
 
ps ax | grep courier

If you see no output, try to start the Courier-IMAP service from the command line:
 
service courier-imap start

Check /var/log/messages and /usr/local/psa/var/log/maillog for possible start up errors:
 
cat /var/log/messages
cat /usr/local/psa/var/log/maillog

If after attempting to restart the service you are still encountering a connection refused error message, try to run courier-imap with the default configuration. To do this, backup the original configuration files:
  • /etc/courier-imap/pop3d for POP3
  • /etc/courier-imap/imapd for IMAP
Replace these with the default distribution configuration files:
  • /etc/courier-imap/pop3d.dist for POP3
  • /etc/courier-imap/imapd.dist for IMAP
Now, restart courier-imap and try to login again. In case of success, compare the original and *.dist files in order to find the option that may have caused the problem.

Saturday 29 June 2013

How many users are logging in system

Display total connect time of users

Ac command will display the statistics about the user’s connect time.

Connect time for the current logged in user

With the option –d, it will break down the output for the individual days. In this example, I’ve been logged in to the system for more than 6 hours today. On Dec 1st, I was logged in for about 1 hour.
 
# ac –d

Dec  1  total        1.08
Dec  2  total        0.99
Dec  3  total        3.39
Dec  4  total        4.50
Today   total        6.10

Connect time for all the users

To display connect time for all the users use –p as shown below. Please note that this indicates the cumulative connect time for the individual users.
 
# ac -p 
        harry                               3.64
        madison                             0.06
        sanjay                              88.17
        nitesh                              105.92
        rakesh                              111.42
        total 309.21

Connect time for a specific user

To get a connect time report for a specific user, execute the following:
# ac -d nitesh

Jul  2  total       12.85
Aug 25  total        5.05
Sep  3  total        1.03
Sep  4  total        5.37
Dec 24  total        8.15
Dec 29  total        1.42
Today   total        2.95

Basic Directory in Linux

DirectoryDescription
/This is the root directory which should contain only the directories needed at the top level of the file structure.
/binThis is where the executable files are located. They are available to all user.
/devThese are device drivers.
/etcSupervisor directory commands, configuration files, disk configuration files, valid user lists, groups, ethernet, hosts, where to send critical messages.
/libContains shared library files and sometimes other kernel-related files.
/bootContains files for booting the system.
/homeContains the home directory for users and other accounts.
/mntUsed to mount other temporary file systems, such as cdrom and floppy for the CD-ROM drive and floppy diskette drive, respectively
/procContains all processes marked as a file by process number or other information that is dynamic to the system.
/tmpHolds temporary files used between system boots
/usrUsed for miscellaneous purposes, or can be used by many users. Includes administrative commands, shared files, library files, and others
/varTypically contains variable-length files such as log and print files and any other type of file that may contain a variable amount of data
/sbinContains binary (executable) files, usually for system administration. For example fdisk and ifconfig utlities.
/kernelContains kernel files

Linux Basic Commands

CommandDescription
cat filenameDisplays a filename.
cd dirnameMoves you to the directory identified.
cp file1 file2Copies one file/directory to specified location.
file filenameIdentifies the file type (binary, text, etc).
find filename dirFinds a file/directory.
head filenameShows the beginning of a file.
less filenameBrowses through a file from end or beginning.
ls dirnameShows the contents of the directory specified.
mkdir dirnameCreates the specified directory.
more filenameBrowses through a file from beginning to end.
mv file1 file2Moves the location of or renames a file/directory.
pwdShows the current directory the user is in.
rm filenameRemoves a file.
rmdir dirnameRemoves a directory.
tail filenameShows the end of a file.
touch filenameCreates a blank file or modifies an existing file.s attributes.
whereis filenameShows the location of a file.
which filenameShows the location of a file if it is in your PATH.       

Grub recovering in linux

GRUB recover using rescue mode


Linux recover boot loader or filesystem corruption using Rescue Mode

Here are the steps to recover corrupted linux filesystem (with or without LVM) or boot loader:

1) Boot system using Linux OS (should be the same version which is installed or needs to recover) CD/USB

2) When prompted, type ''linux rescue''

3) This will ask You for some questions like need to enable network or not and mount system or not

In case of installation/repair or grub boot loader

4) Try to mount file system and use following command to install grub

#grub-install /dev/sda 

(should be a first partition where MBR resides)

run exit to reboot into new installed and recovered grub boot loader

In case of filesystem repair (skip step 4)

5) Do not mount partition

6) run following command over shell

#e2fsck -p /dev/sda{1,2,3....}     Partition which required to recover
#fsck -p /dev/sda{1,2,3}             Partition which required to recover

If all goes well reboot your system :)

In case of LVM filesystem repair (skip step 4 & 6)


7) In case of rescue mode, LVMs are not in active state we require to activate them manually

8) To check and activate LVMs run following commands:

#lvm pvscan             (Scan for PVs available and show them)
#lvm vgscan             (Scan for VGs available and show them)
#lvm vgchange VGName -a y 

(This will activate all VGs LVM volumes)

#lvm lvscan               (Scan LVMs available)

9) Now use Step 6 (change partition with LVMs partition number which is shown by ''lvm lvscan'')

Thats it!!! Plz mail me if u have any problem to perform any repair process.
Piyush.kumar100@gmail.com
piyushgupta@tetrain.com

Diffrence between ext2, ext3 and ext4

Differences between Ext2,Ext3 and Ext4 file systems

it is always a question in our mind what are the basic difference between ext2, ext3 and ext4 filesystems.
So here is the answer for you,

(Note:-) ext2, ext3 and ext4 are all filesystems created for Linux. This article explains the following:

    * High level difference between these filesystems.
    * How to create these filesystems.
    * How to convert from one filesystem type to another.


Ext2

    * Ext2 stands for second extended file system.
    * It was introduced in 1993. Developed by Rémy Card.
    * This was developed to overcome the limitation of the original ext file system.
    * Ext2 does not have journaling feature.
    * On flash drives, usb drives, ext2 is recommended, as it doesn’t need to do the over head of journaling.
    * Maximum individual file size can be from 16 GB to 2 TB
    * Overall ext2 file system size can be from 2 TB to 32 TB


Ext3

    * Ext3 stands for third extended file system.
    * It was introduced in 2001. Developed by Stephen Tweedie.
    * Starting from Linux Kernel 2.4.15 ext3 was available.
    * The main benefit of ext3 is that it allows journaling.
    * Journaling has a dedicated area in the file system, where all the changes are tracked. When the system crashes, the possibility of file system corruption is less because of journaling.
    * Maximum individual file size can be from 16 GB to 2 TB
    * Overall ext3 file system size can be from 2 TB to 32 TB
    * There are three types of journaling available in ext3 file system.
          o Journal – Metadata and content are saved in the journal.
          o Ordered – Only metadata is saved in the journal. Metadata are journaled only after writing the content to disk. This is the default.
          o Writeback – Only metadata is saved in the journal. Metadata might be journaled either before or after the content is written to the disk.
    * You can convert a ext2 file system to ext3 file system directly (without backup/restore).

Ext4

    * Ext4 stands for fourth extended file system.
    * It was introduced in 2008.
    * Starting from Linux Kernel 2.6.19 ext4 was available.
    * Supports huge individual file size and overall file system size.
    * Maximum individual file size can be from 16 GB to 16 TB
    * Overall maximum ext4 file system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB (terabyte).
    * Directory can contain a maximum of 64,000 subdirectories (as opposed to 32,000 in ext3)
    * You can also mount an existing ext3 fs as ext4 fs (without having to upgrade it).
    * Several other new features are introduced in ext4: multiblock allocation, delayed allocation, journal checksum. fast fsck, etc. All you need to know is that these new features have improved the performance and reliability of the filesystem when compared to ext3.
    * In ext4, you also have the option of turning the journaling feature “off”.

How to create ext2, ext3, and ext4 partition.

Once you’ve partitioned your hard disk using fdisk command, use mke2fs to create either ext2, ext3, or ext4 file system.

Create an ext2 file system:
mke2fs /dev/sda1

Create an ext3 file system:
mkfs.ext3 /dev/sda1
(or)
mke2fs –j /dev/sda1

Create an ext4 file system:
mkfs.ext4 /dev/sda1
(or)
mke2fs -t ext4 /dev/sd

How to convert EXT2 partition to EXT3 in linux

Converting ext2 to ext3.

For example, if you are upgrading /dev/sda2 that is mounted as /home, from ext2 to ext3, do the following.
umount /dev/sda2
tune2fs -j /dev/sda2
mount /dev/sda2 /home

Note: You really don’t need to umount and mount it, as ext2 to ext3 conversion can happen on a live file system. But, I feel better doing the conversion offline.

What is Journaling...?

Journaling is only used when writing to a disk and it acts as a sort of punch clock for all writes. This fixes the problem of disk corruption when things are written to the hard drive and then the computer crashes or power is lost. Without a journal the operating system would have no way to know if the file was completely written to disk.
With a journal the file is first written to the journal, punch-in, and then the journal writes the file to disk when ready. Once it has successfully written to the disk, it is removed from the journal, punch-out, and the operation is complete. If power is lost while being written to disk the file system can check the journal for all operations that have not yet been completed and remember where it left off.
The biggest downside to journaling is that it sacrifices some performance in exchange for stability. There is more overhead to write a file to disk but file systems get around this overhead by not writing the full file to the journal. Instead only the file metadata, inode, or disk location is recorded before actually being written to disk.

Done.

IPTABLES CONFIGURATION

IP-TABLES Configuration

# iptables -I INPUT -p tcp -s 192.168.0.6 -m time --weekdays Tu  --dport 22 -j REJECT 

(Here a/c to this rule 22 port is block on every tuesday for this source)

# iptables -I INPUT -p tcp -s 192.168.0.6 -m time --weekdays Tu  -m time --timestart 17:00 --timestop 17:30 --dport 22 -j REJECT 


(Here a/c to this rule 22 port is block for source on tuesday only between
5:00 pm to 5:30 pm)# iptables -I INPUT -p tcp -s 192.168.0.6  -m time --datestart 2012-06-05 --datestop 2012-06-06 --dport 22 -j REJECT

(Here a/c to this rule 22 port block for source from 05-06-2012 to 06-06-2012)

# iptables -I INPUT -p tcp -s 192.168.0.6  -m time --datestart 2012-06-05T17:20 --datestop 2012-06-06T17:45 --dport 22 -j REJECT 

(Here a/c to this rule 22 port is block for source from 05-06-2012 to 06-06-2012 between 5:20 pm to 5:45 pm)

Allow Limited connection of ssh

If you want to allow limited connetion for specific service like ssh->
You can adjust the numbers yourself to limit connections further, so the following example will drop incoming connections which make more than 2 connection attempts upon port22 within ten minutes:


[root@piyush~]#iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent  --set


[root@piyush~]#iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent  --update --seconds 600 --hitcount 2 -j DROP

Adobe Flash Player installation on Linux

Install adobe flash player in linux

How can we install adobe flash player in linux-RHEL6


Download adobe rpm 


http://get.adobe.com/flashplayer/completion/?installer=Flash_Player_11.2_for_other_Linux_(.tar.gz)_64-bit

[ root @ piyush ~ ] # cd Download
[ root @ piyush ~ ] # ls

install_flash_player_11_linux.x86_64.tar.gz

[ root @ piyush ~ ] #gunzip install_flash_player_11_linux.x86_64.tar.gz

[ root @ piyush ~ ] # ls

[ root @ piyush ~ ]#tar -xvf  install_flash_player_11_linux.x86_64.tar

[ root @ piyush ~ ] # ls

readme.txt     usr   libflashplayer.so 

[ root @ piyush ~ ] # cp    libflashplayer.so  /usr/lib64/mozilla/plugins

[ root @  piyush~ ] # cp    -rvf    usr/*     /usr/

[ root @ piyush ~ ] # exit


Now Open Mozila and try to open 

www.youtube.com

Now u can see all videos.

**********************   enjoy ***************************

Mount and Access NTFS Partition in Linux ( RHEL, Cent-os )

Mount and Access NTFS Partition in RHEL

How to enable NTFS support on CentOS Linux version 5 or 6? 
How do I mount ntfs partition under RHEL 5 or 6?

First, you need to install EPEL repo as described here. The following command will turn in EPEL repo on RHEL / CentOS version 6.x:
# cd /tmp
#wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm
#rpm -ivh epel-release-6-5.noarch.rpm

NTFS-3G


NTFS-3G is a stable, open source, GPL licensed, POSIX, read/write NTFS driver for Linux. It provides safe handling of the Windows XP, Windows Server 2003, Windows 2000, Windows Vista, Windows Server 2008 and Windows 7 NTFS file systems.

How Do I Install NTFS-3G?

 # yum install ntfs-3g*   -y

How Do I Find Out NTFS Partition Name?

Simply type the following command:

# fdisk -l /dev/sda 

sample ouput: 
 
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf0000000
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      102400    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2              14       60802   488281089    5  Extended
/dev/sda5              14       59767   479970304   83  Linux
/dev/sda6           59767       60802     8309760   82  Linux swap / Solaris

How Do I Mount /dev/sda1 NTFS Partition at /mnt/ntfs?

First, load the fuse driver, enter:

# modprobe fuse

Create a mount point, enter:

# mkdir /mnt/ntfs

To mount the ntfs partition, enter:

# mount -t ntfs-3g /dev/sda1 /mnt/ntfs

You can use regular Unix commands to copy or access the files:

# df -h
# mount
# cd /mnt/ntfs
# cp foo /tmp

How Do I Unmount NTFS Partition?

Type the following command:

# umount /mnt/ntfs

APACHE SERVER CONFIGURATION STEP BY STEP

Install Apache Webserver in CentOS 6.3 & RHEL

In this how-to tutorial I’ll show you how to install Apache and host a sample website using Apache.

Scenario

In this how-to tutorial, my test scenario setup are as follows

Webserver Details:

Operating System  :  CentOS 6.3 32bit server
Hostname          :  web.example.com
IP Address        :  192.168.1.250

Client Details:

Operating System  :  CentOS 6.3 32bit Desktop
Hostname          :  client.example.com
IP Address        :  192.168.1.251
 
I already have a DNS server in my setup and i had properly configured the DNS server with both server and client details.

Server side configuration

Prerequisites:

1. Set the hostname of web server

[root@web ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=web.example.com

2. Add the webserver hostname in ‘etc/hosts’ file

[root@web ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.250   web.example.com
192.168.1.250   www.example.com

3. Install Apache

Check and remove any previously installed packages
 
[root@web ~]# rpm -qa | grep httpd
or
 
[root@web ~]# yum list installed | grep httpd
 
Now install the ‘httpd’ package
 
[root@web ~]# yum install httpd* -y

4. Configure Apache

[root@web ~]# vi /etc/httpd/conf/httpd.conf 
## line no 262 - Set the server admin mail id which is used to receive mail generated by apache ##
ServerAdmin root@ostechnix.com
## line no 276 - Set the website name ##
ServerName www.ostechnix.com:80
## line no 292 - Set the web pages folder ##
DocumentRoot "/var/www/html"
## line no 402 - Sent the index or home page of the website ##
DirectoryIndex ostechnix.html

5. Create a sample index or home page

Create the index or home page html file in the ‘/var/www/html/’ directory
 
[root@web ~]# vi /var/www/html/example.html 
<html>
<body bgcolor=blue>
        <h1> Welcome to EXAMPLE Website </h1> 
</body>
</html>

6. Allow webserver through firewall

[root@web ~]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
 
Restart iptables to save changes
 
[root@web ~]# service iptables restart
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]

7. Start Apache web server

[root@web ~]# service httpd start
Starting httpd:                                            [  OK  ]
[root@web ~]# chkconfig httpd on

Client side Configuration

1. Add the webserver and client ip address and hostname in the ‘/etc/hosts’ file

[root@client ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.251   client.ostechnix.com
192.168.1.250   www.ostechnix.com

2. Check Apache webserver

Open the firefox in client and type http://www.example.com in the address bar. The index page of example website will open now.

Global Yum Configuration




Global Yum configuration with  RPMForge repository in CentOS 6.3 / RHEL 6.3

RPMForge is one of the best known repository in Linux world. It is used to install third party softwares in RPM based distributions. It contains more than 5000 packages.

Install RPMForge repository in CentOS

The steps provided here are tested in CentOS 6.3 32 bit edition, though it will work on RHEL 6.x/Scientific Linux 6.x too.
First check your operating system version. Then download the relevent repository. To check OS version use “uname -a” command.
 
[root@mainserver ~]# uname -a
Linux mainserver.example.com 2.6.32-279.el6.i686 #1 SMP Fri Jun 22 10:59:55 UTC 2012 i686 i686 i386 GNU/Linux
To install Rpmforge repository for 32 bit use the following commands.
 
[root@mainserver ~]# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
--2013-01-31 15:40:06--  http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
Resolving packages.sw.be... 78.46.17.228
Connecting to packages.sw.be|78.46.17.228|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm [following]
--2013-01-31 15:40:07--  http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
Resolving pkgs.repoforge.org... 78.46.17.228
Connecting to pkgs.repoforge.org|78.46.17.228|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://rpmforge.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm [following]
--2013-01-31 15:40:09--  http://rpmforge.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
Resolving rpmforge.sw.be... 78.46.17.228
Connecting to rpmforge.sw.be|78.46.17.228|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://tree.repoforge.org/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm [following]
--2013-01-31 15:40:10--  http://tree.repoforge.org/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
Resolving tree.repoforge.org... 78.46.17.228
Connecting to tree.repoforge.org|78.46.17.228|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://apt.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm [following]
--2013-01-31 15:40:12--  http://apt.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
Resolving apt.sw.be... 193.1.193.67
Connecting to apt.sw.be|193.1.193.67|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12732 (12K) [application/x-redhat-package-manager]
Saving to: `rpmforge-release-0.5.2-2.el6.rf.i686.rpm'
100%[======================================>] 12,732      9.60K/s   in 1.3s    
2013-01-31 15:40:15 (9.60 KB/s) - `rpmforge-release-0.5.2-2.el6.rf.i686.rpm' saved [12732/12732]
For 64 bit use the following command.
 
[root@mainserver ~]# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el4.rf.x86_64.rpm
[root@mainserver ~]# rpm -ivh rpmforge-release-0.5.2-2.el4.rf.x86_64.rpm
Then import the key and install RPMForge.
 
[root@mainserver ~]# rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
[root@mainserver ~]#  rpm -K rpmforge-release-0.5.2-2.el6.rf.*.rpm
rpmforge-release-0.5.2-2.el6.rf.i686.rpm: (sha1) dsa sha1 md5 gpg OK
[root@mainserver ~]# rpm -ivh rpmforge-release-0.5.2-2.el6.rf.i686.rpm 
Preparing...                ########################################### [100%]
   1:rpmforge-release       ########################################### [100%]

Test RPMForge Repository

Now let us install a sample package to verify whether Rpmforge repository is working or not.
 
[root@mainserver ~]# yum install htop
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror-fpt-telecom.fpt.net
 * extras: mirror-fpt-telecom.fpt.net
 * rpmforge: mirror-fpt-telecom.fpt.net
 * updates: ftp.iitm.ac.in
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package htop.i686 0:1.0.2-1.el6.rf will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
 Package       Arch          Version                    Repository         Size
================================================================================
Installing:
 htop          i686          1.0.2-1.el6.rf             rpmforge           78 k
Transaction Summary
================================================================================
Install       1 Package(s)
Total download size: 78 k
Installed size: 186 k
Is this ok [y/N]: y
Downloading Packages:
htop-1.0.2-1.el6.rf.i686.rpm                             |  78 kB     00:01     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : htop-1.0.2-1.el6.rf.i686                                     1/1 
  Verifying  : htop-1.0.2-1.el6.rf.i686                                     1/1 
Installed:
  htop.i686 0:1.0.2-1.el6.rf                                                    
Complete!

Disable RPMForge Repository

To disable RPMForge repository navigate to /etc/yum.repos.d/, open the rpmforge.repo file and set enabled=0.
 
### Name: RPMforge RPM Repository for RHEL 6 - dag
### URL: http://rpmforge.net/
[rpmforge]
name = RHEL $releasever - RPMforge.net - dag
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/rpmforge
mirrorlist = http://apt.sw.be/redhat/el6/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
Thats it. Have a good day.

NFS Server configuration Steps



NFS Server configuration  Step by step on RHEL  & Cent-os


In this tutorial let us see how to install and configure NFS server and how to share files between NFS server and clients. Though i have tested these steps in CentOS 6.3 32 bit edition, it will work on RHEL/Scientific Linux 6.x too.

Scenario

NFS Server Operating System : CentOS 6.3 32 bit (Minimal server install)
NFS Client Operating System  : CentOS 6.3 32 bit (Minimal Desktop install)
NFS Server IP Address              : 192.168.1.200/24
NFS Client IP Address               : 192.168.1.29/24

1. Install NFS in Server

[root@server ~]# yum install nfs* -y

2. Start NFS service

[root@server ~]# /etc/init.d/nfs start
Starting NFS services:                                     [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Stopping RPC idmapd:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
[root@server ~]# chkconfig nfs on

3. Install NFS in Client

[root@vpn client]# yum install nfs* -y

4. Start NFS service in client

[root@vpn client]# /etc/init.d/nfs start
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Stopping RPC idmapd:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
[root@vpn client]# chkconfig nfs on

5. Create shared directories in server

Let us create a shared directory called ‘/home/piyush’ in server and let the client users to read and write files in the ‘home/piyush’ directory.
 
[root@server ~]# mkdir /home/piyush
[root@server ~]# chmod 755 /home/piyush/

6. Export shared directory on server

Open /etc/exports file and add the entry as shown below
 
[root@server ~]# vi /etc/exports
/home/piyush 192.168.1.0/24(rw,sync,no_root_squash,no_all_squash)
where,
 /home/piyush  - shared directory
192.168.1.0/24      - IP address range of clients to access the shared folder
rw                           – Make the shared folder to be writable
sync                        - Synchronize shared directory whenever create new files/folders
no_root_squash   – Enable root privilege  (Users can read, write and delete the files in the shared directory)
no_all_squash      - Enable user’s authority 
Now restart the NFS service.
 
[root@server ~]# /etc/init.d/nfs restart
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Starting NFS services:                                     [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Stopping RPC idmapd:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]        -  

7. Mount shared directories in client

Create a mount point to mount the shared directories of server.
To do that create a directory called ‘/nfs/shared’ (You can create your own mount point)
 
[root@vpn client]# mkdir -p /nfs/shared
Now mount the shared directories from server as shown below
 
[root@vpn client]# mount -t nfs 192.168.1.200:/home/piyush/ /nfs/shared/
This will take a while and shows a connection timed out error for me. Well, don’t panic, firwall might be restricting  the clients to mount shares from server. Simply stop the iptables to rectify the problem or you can allow the NFS service ports through iptables.
To do that open the /etc/sysconfig/nfs file and uncomment the lines which are marked in bold.
 
[root@server ~]# vi /etc/sysconfig/nfs
#
# Define which protocol versions mountd 
# will advertise. The values are "no" or "yes"
# with yes being the default
#MOUNTD_NFS_V2="no"
#MOUNTD_NFS_V3="no"
#
#
# Path to remote quota server. See rquotad(8)
#RQUOTAD="/usr/sbin/rpc.rquotad"
# Port rquotad should listen on.
RQUOTAD_PORT=875
# Optinal options passed to rquotad
#RPCRQUOTADOPTS=""
#
#
# Optional arguments passed to in-kernel lockd
#LOCKDARG=
# TCP port rpc.lockd should listen on.
LOCKD_TCPPORT=32803
# UDP port rpc.lockd should listen on.
LOCKD_UDPPORT=32769
#
#
# Optional arguments passed to rpc.nfsd. See rpc.nfsd(8)
# Turn off v2 and v3 protocol support
#RPCNFSDARGS="-N 2 -N 3"
# Turn off v4 protocol support
#RPCNFSDARGS="-N 4"
# Number of nfs server processes to be started.
# The default is 8. 
#RPCNFSDCOUNT=8
# Stop the nfsd module from being pre-loaded
#NFSD_MODULE="noload"
# Set V4 grace period in seconds
#NFSD_V4_GRACE=90
#
#
#
# Optional arguments passed to rpc.mountd. See rpc.mountd(8)
#RPCMOUNTDOPTS=""
# Port rpc.mountd should listen on.
MOUNTD_PORT=892
#
#
# Optional arguments passed to rpc.statd. See rpc.statd(8)
#STATDARG=""
# Port rpc.statd should listen on.
STATD_PORT=662
# Outgoing port statd should used. The default is port
# is random
STATD_OUTGOING_PORT=2020
# Specify callout program 
#STATD_HA_CALLOUT="/usr/local/bin/foo"
#
#
# Optional arguments passed to rpc.idmapd. See rpc.idmapd(8)
#RPCIDMAPDARGS=""
#
# Set to turn on Secure NFS mounts. 
#SECURE_NFS="yes"
# Optional arguments passed to rpc.gssd. See rpc.gssd(8)
#RPCGSSDARGS=""
# Optional arguments passed to rpc.svcgssd. See rpc.svcgssd(8)
#RPCSVCGSSDARGS=""
#
# To enable RDMA support on the server by setting this to
# the port the server should listen on
#RDMA_PORT=20049 
Now restart the NFS service 
 
[root@server ~]# /etc/init.d/nfs restart
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Starting NFS services:                                     [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Stopping RPC idmapd:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Add the lines shown in bold in  ‘/etc/sysconfig/iptables’ file.
 
[root@server ~]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
-A INPUT -m state --state NEW -m udp -p udp --dport 2049 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 111 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 111 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 32769 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 32803 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 892 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 892 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 875 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 875 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 662 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 662 -j ACCEPT:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
Now restart the iptables service
 
[root@server ~]# service iptables restart
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]
Again mount the share from client
 
[root@vpn client]# mount -t nfs 192.168.1.200:/home/piyush/ /nfs/shared/
Finally the NFS share is mounted without any connection timed out error.
To verify whether the shared directory is mounted, enter the mount command in client system.
 
[root@vpn client]# mount
/dev/mapper/vg_vpn-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
192.168.1.200:/home/piyush/ on /nfs/shared type nfs (rw,vers=4,addr=192.168.1.200,clientaddr=192.168.1.29)

8. Testing NFS

Now create some files or folders in the ‘/nfs/shared’ directory which we mounted in the previous step.
 
[root@vpn shared]# mkdir test
[root@vpn shared]# touch file1 file2 file3
Now go to the server and change to the ‘/home/piyush’ directory.
 
[root@server ~]# cd /home/ostechnix/
[root@server ostechnix]# ls
file1  file2  file3  test
[root@server ostechnix]# 
Now the files and directories are listed which are created from the client. Also you can share the files from server to client and vice versa.

9. Automount the Shares

If you want to mount the shares automatically instead mounting them manually at every reboot, add the following lines shown in bold in the ‘/etc/fstab’ file of client system.
 
[root@vpn client]# vi /etc/fstab 
#
# /etc/fstab
# Created by anaconda on Wed Feb 27 15:35:14 2013
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_vpn-lv_root /                       ext4    defaults        1 1
UUID=59411b1a-d116-4e52-9382-51ff6e252cfb /boot                   ext4    defaults        1 2
/dev/mapper/vg_vpn-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
192.168.1.200:/home/piyush /nfs/shared nfs rw,sync,hard,intr 0 0

10. Verify the Shares

Reboot your client system and verify whether the share is mounted automatically or not.
 
[root@vpn client]# mount
/dev/mapper/vg_vpn-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
192.168.1.200:/home/piyush on /nfs/shared type nfs (rw,sync,hard,intr,vers=4,addr=192.168.1.200,clientaddr=192.168.1.29)nfsd on /proc/fs/nfsd type nfsd (rw)
Thats it. Have a Good day!!

Create Virtual CD on Ubantu


Create Virtual CD And DVD Drives using CDemu in Ubuntu 12.10

CDemu is a Software suite to mount your images such as ISO, IMG, BIN and MDF (CD or DVD Images) in Linux without having to write in physical media. For more information visit the Official Website.To install CDemu, open the 

Terminal by pressing CTRL+ALT+T and add its PPA archive:
Then run the commands to update the Repositories and install CDemu:

To start CDemu, Click Menu -> System Settings -> gCDemu. An icon will be displayed in your task bar.


Click the gCDemu icon to get started. Select Device #00 or Device #01 to
mount your images. Click “Load” and browse the ISO to load:


The ISO will be mounted in your File manager:

To unload your ISO after the usage, simply press the “Unload” in the gCDemu window or eject from the file manager:



Thats it. Enjoy!!!

Local Yum Configuration Steps


Setup Local YUM Server in Cent-os and RHEL


Yellowdog updater, Modified (Yum) is a software package manager that installs, updates and removes packages on RPM-based Linux distributions. Yum makes it easier to maintain groups of machines without having to manually update each one using rpm.
Features:
  • Support for multiple repositories.
  • Simple configuration.
  • Automatic dependency calculation.
  • Fast operation.
  • RPM-consistent behavior.
  • Package group support, including multiple-repository groups.
  • Simple interface.
Yum uses an online repository by default, but you can also configure it to use a local repository of packagesY
Let us install a local yum server using CentOS 6.3. The steps provided here are tested in CentOS 6.3. But it will work fine in RHEL 6.x and Scientific Linux 6.x too.
In this example the hostname of the server is myserver.example.com and IP Address is 192.168.56.101. Login to your system and Mount the contents of your CentOS 6.3 DVD in the /mnt directory or wherever you want. In the Terminal window, type the following command:

# mount /dev/cdrom1 /mnt/ (Here cdrom1 is my local cdrom device)


Install vsftpd package, so that we can use this as a FTP server to share our repository in the client systems.
Change to the directory where you mounted CentOS DVD. In our example we have mounted the CentOS DVD in /mnt directory.

# cd /mnt/Packages
# rpm -ivh vsftpd-2.2.2-11.el6.i686.rpm

Start the FTP Service:

# service vsftpd start


Install createrepo package if it is not installed. This is package is used to create our local repository.

# rpm -ivh createrepo-0.9.8-5.el6.noarch.rpm

Oops!! It shows us the dependency problem. Let us the install missing dependencies first:

# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.i686.rpm

Then install the another one:

# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.i686.rpm


 Now install the createrepo package:


Create a folder called localyumserver (You can use your own) in /var/ftp/pub directory to save all the packages from the CentOS DVD. Copy all the files in the Packages folder from the DVD to /var/ftp/pub/localyumserver folder:

# mkdir /var/ftp/pub/localyumserver
# cp -ar *.* /var/ftp/pub/localyumserver


It will take a while to copy all the packages in the DVD. Please be patient. After all packages are copied, create a repo file called localyumserver.repo in /etc/yum.repos.d/ directory.

# nano /etc/yum.repos.d/localyumserver.repo

Type the following entries and save the file (CTRL+O to save and CTRL+X to exit):

Where,

[localyumserver] ==> Name of the Local Repository.
comment ==> Information about the Repository.
baseurl ==> Path of the Repository (i.e where we had copied the contents from CentOS DVD)
gpgcheck ==> Authentication of the Repository, which is disabled in our case.
Now it is time to create our repository. Enter the following command in the Terminal:

# createrepo -v /var/ftp/pub/localyumserver
Now the local YUM repository creation process will begin.


Note: Delete or rename all the other repo files except the newly created repo file i.e in our example it is localyumserver.repo
Next update the repository:
  • yum clean all
  • yum update
You’re done now.

Client side configuration:
Create a repo file in your client system as mentioned above in the /etc/yum.repos.d/ directory and remove or rename the existing repositories. Then modify the baseurl as mentioned below:
 
[localyumserver]
comment ="My Local Repository"
baseurl=ftp://myserver.ostechnix.com/pub/localyumserver
gpgcheck=0
enabled=1 
(or)
[localyumserver]
comment ="My Local Repository"
baseurl=ftp://192.168.56.101/pub/localyumserver
gpgcheck=0
enabled=1
Thats it. Start using Yum. Enjoy!!

FTP Server Configuration Steps



Setup FTP Server step by step in CentOS 6 / RHEL5


Install FTP in CentOS 6.3:

This tutorial shows you how to install and configure FTP server in CentOS 6.3. Though the steps provided here are tested in CentOS 6.3, it should work on RHEL 6. In this tutorial my ftp server ip and hostname are 192.168.1.200 and mainserver.example.com respectively. I have already configured a local repository and i am gonna to install FTP from my local repository.
Before proceed, stop the firewall.
 
[root@mainserver ~]# service iptables stop
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
 
[root@mainserver ~]# service ip6tables stop
ip6tables: Flushing firewall rules:                        [  OK  ]
ip6tables: Setting chains to policy ACCEPT: filter         [  OK  ]
ip6tables: Unloading modules:                              [  OK  ]
 
[root@mainserver ~]# chkconfig iptables off
[root@mainserver ~]# chkconfig ip6tables off
[root@mainserver ~]# 
Now let us install FTP service.
 
[root@mainserver ~]# yum install -y vsftpd
[root@mainserver ~]# Start vsftpd service.
[root@mainserver ~]# service vsftpd start
Starting vsftpd for vsftpd:                                [  OK  ]
 
[root@mainserver ~]# 
Enable vsftpd in multi-user levels.
 
[root@mainserver ~]# chkconfig vsftpd on
Now edit the /etc/vsftpd/vsftpd.conf file. Uncomment and edit the lines in the vsftpd.conf file which are shown in bold.
 
[root@mainserver ~]# cat /etc/vsftpd/vsftpd.conf 
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# The target log file can be vsftpd_log_file or xferlog_file.
# This depends on setting xferlog_std_format parameter
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# The name of log file when xferlog_enable=YES and xferlog_std_format=YES
# WARNING - changing this filename affects /etc/logrotate.d/vsftpd.log
#xferlog_file=/var/log/xferlog
#
# Switches between logging into vsftpd_log_file and xferlog_file files.
# NO writes to vsftpd_log_file, YES to xferlog_file
xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
ascii_upload_enable=YES
ascii_download_enable=YES
#
# You may fully customise the login banner string:
ftpd_banner=Welcome to example FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd with two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
use_localtime=YES
Now let us restart the vsftpd service and try to connect to ftp server.
 
[root@mainserver ~]# service vsftpd restart
Shutting down vsftpd:                                      [  OK  ]
Starting vsftpd for vsftpd:                                [  OK  ]
Connect to the ftp server.
Note: Root is not allowed to connect to ftp server by default for security purpose. So lets us create a new user called piyush.
 
[root@mainserver ~]# useradd piyush
[root@mainserver ~]# passwd piyush
Changing password for user piyush.
New password: 
BAD PASSWORD: it is based on a dictionary word
Retype new password: 
passwd: all authentication tokens updated successfully.
Connet to FTP server using the new user piyush.
 
[root@mainserver ~]# ftp 192.168.1.200
-bash: ftp: command not found
[root@mainserver ~]# 
Oops! ftp package is not installed. So let us install ftp package first.
 
[root@mainserver ~]# yum install -y ftp
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ftp.i686 0:0.17-51.1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
 Package       Arch           Version                 Repository           Size
================================================================================
Installing:
 ftp           i686           0.17-51.1.el6           localrepo            55 k
Transaction Summary
================================================================================
Install       1 Package(s)
Total download size: 55 k
Installed size: 91 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : ftp-0.17-51.1.el6.i686                                       1/1 
  Verifying  : ftp-0.17-51.1.el6.i686                                       1/1 
Installed:
  ftp.i686 0:0.17-51.1.el6                                                      
Complete!
[root@mainserver ~]# 

Again connect to the FTP server.
 
[root@mainserver ~]# ftp 192.168.1.200
Connected to 192.168.1.200 (192.168.1.200).
220 Welcome to example FTP service.
Name (192.168.1.200:root): ostechnix
331 Please specify the password.
Password:
500 OOPS: cannot change directory:/home/ostechnix
Login failed.
ftp> 
It shows a error that the user cannot change to his $HOME directory. Type exit to return back from the ftp console and allow vsftpd daemon to change users into their $HOME directories. To do that update SELinux configuration using the command below.
 
[root@mainserver ~]# setsebool -P ftp_home_dir on
And finally connect to the FTP server.
 
[root@mainserver ~]# ftp 192.168.1.200
Connected to 192.168.1.200 (192.168.1.200).
220 Welcome to Example FTP service.
Name (192.168.1.200:root): piyush
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> pwd
257 "/home/piyush"
ftp> 
Its working now. You can use your FTP server.