Lab requirement: Red Hat Enterprise Linux 5.4 objective: to build a virtual account to log on to the ftp server
Tutorial procedure: [root @ mail ~] # Cd/mnt/cdrom/Server/[enter the server repository] [root @ mail Server] # yum install vsftpd-2.0.5-16.el5.i386.rpm-y-nogpgcheck [install ftp service required package] [root @ mail Server] # vim/etc/vsftpd/vmuser.txt [create a virtual account file]
[Root @ mail Server] # yum install db4-utils-4.3.29-10.el5.i386.rpm-y-nogpgcheck [install db tool, use db_load to generate the corresponding database file] [root @ mail Server] # db_load-T hash-f/etc/vsftpd/vmuser.txt/etc/vsftpd/vmuser. db [generate the database file corresponding to the created virtual account name and password]
[Root @ mail etc] # vim/etc/vsftpd. conf [when a user logs on to ftp, the account is verified under/etc/passwd by default. The 116 lines in this document can be verified using pam. The authentication file name is vsftpd, and this file needs to use the module/lib/security/pam_userdb.so]
(View the module method: man/usr/share/doc/pam-0.99.6.2/txts/README. pam_userdb, you can see that the pam_userdb module is used to verify the user name and password stored in the database.] [root @ mail ~] # Vim/etc/pam. d/vsftpd
[Root @ mail ~] # Useradd user1 [Create user1] [root @ mail ~] # Passwd user1 [Create a password for user1] [root @ mail ~] # Vim/etc/vsftpd. conf [map a virtual account to a local account and add line 1]
[Root @ mail home] # chmod 744 user1/[modify the usr1 folder permission and grant the read permission so that users entering user1 can read the files in the folder]
[Root @ mail ~] # Service vsftpd restart [restart ftp service] [root @ mail ~] # Chkconfig vsftpd on [set ftp service to start automatically upon startup] [access host Test Virtual Account Login ftp server]
[The virtual Account Login is mapped to user1 successfully]
[Set User restrictions] [anonymous accounts can access the company's public documents [do not allow anonymous users to upload documents] [documents cannot be uploaded using anonymous accounts]
[Create a New partition for Disk Quota and increase the partition size to MB] [root @ mail vsftpd] # fdisk/dev/sda
[Root @ mail ~] # Partprobe/dev/sda [re-read Partition Table] [root @ mail ~] # Cat/proc/partitions [view partition information and verify whether the partition is successfully added]
[Root @ mail ~] # Mkfs-t ext3/dev/sda4 [format new partition, format: ext3] [root @ mail ~] # Mkdir/mnt/partion [Create a disk partition mount point] [root @ mail ~] # Vim/etc/fstab [mount the/dev/sda4 partition to the system permanently]
[Root @ mail ~] # Mount-a [enable Disk Quota] [root @ mail ~] # Mount [view mounting information. mounting successful]
[Root @ mail ~] # Quotacheck-augvc [execute the quotacheck-augvc Detection Environment and generate the user's quota file] [root @ mail ~] # Edquota-u user1 [edit the quota file of user1]
[Root @ mail ~] # Quotaon/dev/sda4 [enable Disk Quota] [root @ mail ~] # Vim/etc/rc. d/rc. local [Add the command for starting the script file]
[Root @ mail ~] # Mkdir/mnt/partion/home [home directory of the ftp user created] [root @ mail ~] # Cd/home/[root @ mail home] # mv */mnt/partion/home/[In this case, the home Directory of user1 is under the/root directory, the disk quota is on/dev/sda4. You need to move the home directory to/dev/sda4]
[Root @ mail home] # cd/mnt/partion/[root @ mail partion] # chmod-R o + rw home [recursively identical all files and subdirectories in the current directory permission change] [root @ mail partion] # vim/etc/passwd [store the password file in the/mnt/partion/home Directory]
[Root @ mail partion] # cd/mnt/partion/home/user1/[enter the disk quota user1 Directory] [root @ mail user1] # touch f1.user1 [Create a new file, test whether the root directory accessed by ftp is in this directory. [test whether the ftp root directory is in/mnt/partion/home]
Http://zhangc.blog.51cto.com/5627676/1004607