RHCE Questions for Practices

How to Enable VSFTP on Redhat Enterprise Linux 4 update 3:

To lock users in home dir:
Touch vsftpd.chroot_list ; to create file of users that are allowed to ftp outside their home dirs add root to this file
Cd /etc/vsftpd vi vsftpd.conf

# 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_list_enable=YES chroot_local_user=YES

# (default follows)
chroot_list_file=/etc/vsftpd.chroot_list ; add root to this file service vsftpd restart
To lock users in home dir:
Touch vsftpd.chroot_list ; to create file of users that are allowed to ftp outside their home dirs add root to this file
 

How to stop/start network ethernet interface:

[root@ice ~]# ifdown eth0

[root@ice ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:2A:47:7F

inet addr:192.168.0.103 Bcast:192.168.0.255 Mask:255.255.255.0 BROADCAST MULTICAST MTU:1500 Metric:1

RX packets:1899 errors:0 dropped:0 overruns:0 frame:0 TX packets:833 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000

RX bytes:923925 (902.2 KiB) TX bytes:283867 (277.2 KiB) Interrupt:10 Base address:0x1400

[root@ice ~]# ifup eth0

Determining IP information for eth0... done. [root@ice ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:2A:47:7F

inet addr:192.168.0.103 Bcast:192.168.0.255 Mask:255.255.255.0

inet6 addr: fe80::20c:29ff:fe2a:477f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1900 errors:0 dropped:0 overruns:0 frame:0 TX packets:838 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000

RX bytes:924267 (902.6 KiB) TX bytes:284517 (277.8 KiB) Interrupt:10 Base address:0x1400
 

How to Create and Mount filesystem in redhat enterprise Linux:

Redhat Enterprise 4 Linux you can use fdisk -l to list existing partitions on your system as a part of your Lab in RH133 Course : 

[root@ice ~]# fdisk -l /dev/sda

Disk /dev/sda: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 1318 10482412+ 8e Linux LVM

/dev/sda3 1319 1579 2096482+ 82 Linux swap /dev/sda4 1580 2610 8281507+ 5 Extended

Here we have unallocated extended partition. Remember you can have only 3 Primary partitions for a single disk in Redhat in our case we have SCSI disk /dev/sda where we have 3 primary partitions,with remaining unlloacted space you need to create Extended partition if you need to create more than 3 partitions . 

#fdisk /dev/sda

ON COMMAND TYPE n to create new partition , hit enter for start cylinder number and then on last cyliner i used +1024M you can use +1G as well , because I am going to create 1 GB filesystem : 

Command (m for help): n

First cylinder (1580-2610, default 1580): Using default value 1580

Last cylinder or +size or +sizeM or +sizeK (1580-2610, default 2610): +1024M

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

The kernel still uses the old table.

The new table will be used at the next reboot. Syncing disks.

Here is a catch that would be really stupid idea to reboot your Redhat enterprise Linux server to activate your partition table changes. I am sure Redhat will remove this warning in their upcoming redhat enterprise level 5 Linux version.  Also you can save time in your RHCT/RHCE Certification Exam using partprobe. Note this how I am activating new partition table changes using PARTPROBE magic command.

[root@ice ~]# partprobe

[root@ice ~]# fdisk -l /dev/sda

Disk /dev/sda: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 1318 10482412+ 8e Linux LVM

/dev/sda3 1319 1579 2096482+ 82 Linux swap /dev/sda4 1580 2610 8281507+ 5 Extended /dev/sda5 1580 1704 1004031 83 Linux

Now I have to create a directory where I need to mount new +1 GB fileystem I am going to make ext3 filesystem . 

#mkdir /home

[root@ice ~]# mkfs -t ext3 /dev/sda5 [root@ice ~]# mount /dev/sda5 /home [root@ice ~]# df -h /home

Filesystem Size Used Avail Use% Mounted on /dev/sda5 966M 18M 899M 2% /home

Here is your +1GB home filesystem (type is ext3) ready to use. You can add this in yout /etc/fstab file to make change permanent where it will mount /home automatically and persistent to server reboots.

Have a Linux Problem
Linux Forum - Do you have a Linux Question?

Linux Books
Linux Certification, System Administration, Programming, Networking Books

Linux Home: Linux System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.