Sunday, March 29, 2009

LVM2

Logical Volume Manager

LVM is a tool for logical volume management which includes allocating disks, striping, mirroring
and resizing logical volumes

LVM version 2, or LVM2, is the default for Red Hat Enterprise Linux 5, which uses the device
mapper driver contained in the 2.6 kernel.

Steps required to configure LVM include:

• Creating physical volumes from the hard drives.
• Creating volume groups from the physical volumes.
• Creating logical volumes from the volume groups and assign the logical volumes mount
points.

PHYSICAL VOLUMES ---> VOLUME GROUP ---> LOGICAL VOLUME ---> MOUNT POINT/FILE SYSTEMS

(note: For Red Hat Enterprise Linux, LVM is the default method for disk partitioning: To verify it, try to use the default installation and see the File Systems, you can see LVM )
Let me walk you through the manual LVM configuration while linu installation:
Lets say my system has 2 IDE drives each of 3.0GB; As we know for linux installation, minimally we need to create following 3 partitions
/boot : it can't be created in logical volume
swap
/
(note: The physical volumes are combined into logical volumes, with the exception of the /boot/partition. The /boot/ partition cannot be on a logical volume group because the boot loadercannot read it. If the root (/) partition is on a logical volume, create a separate /boot/ partitionwhich is not a part of a volume group. )
......... will be discussed in detailed in lab............


Sunday, March 15, 2009

How to setup VSFTP server in RHEL5?

VSFTP: Very Secure File Transfer Protocol


========SERVER=============

[root@ilinux ~]# rpm -qa|grep vsftpd
vsftpd-2.0.5-12.el5

[root@ilinux ~]# service vsftpd status
vsftpd is stopped

[root@ilinux ~]# service vsftpd start
Starting vsftpd for vsftpd: [ OK ]

[root@ilinux ~]# chkconfig --list vsftpd
vsftpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off

[root@ilinux ~]# chkconfig --level 35 vsftpd on
[root@ilinux ~]# chkconfig --list vsftpd
vsftpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off

[root@ilinux ~]# vi /etc/vsftpd/vsftpd.conf

By default, anonymous user can do ftp without password;
anonymous user is chrooted to /var/ftp as "/"
local users (linux users) can do ftp using password;
local users are not chrooted by default; i.e local users can access all the resources of the system using ftp

===========CLIENT SIDE================

#ftp IP-ADD of server
username: anonymous
password: password is not required
ftp>help
ftp>ls {it will show the content of the remote/server}
ftp>!ls {it will display the content of the local system}
ftp>pwd {it will show the PWD of the remote/server}
ftp>lcd {it will display the LOCAL working directory}

[notice: for anonymous user pwd will display "/" which is chrooted to /var/ftp]

#ftp IP-ADD of server
username: local user's username
password: password
ftp>........
...............
[notice: for local users by default pwd will be "/home/username" and local users can change the location on the remote server i.e he can go to /etc or any possible location and thus can theft the important data easily]

========================================
========================================

=========SERVER SIDE================
Q: How to create chroot jail for the local users?
A: For this we need to uncomment few lines shown below in /etc/vsftpd/vsftpd.conf

#vi /etc/vsftpd/vsftpd.conf
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list

#vi /etc/vsftpd/chroot_list
[add the usernames to be chrooted to /home/username]

#service vsftpd restart

=============CLIENT SIDE==================

#ftp
username:
password:
ftp>........
...............

[now PWD will show "/" as user is chrooted to /home/username and local users cannot change the location outside /home/username as "/" for this user will be "/home/username"