Use a virtual account to build an ftp server

Source: Internet
Author: User
Lab requirement: RedHatEnterpriseLinux5.4 objective: to set up a virtual account to log on to the ftp server: [root @ mail ~] # Cd/mnt/cdrom/Server/[enter server repository] [root @ mailServer] # yuminstallvsftpd-2.0.5...
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
 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.