Compile and deploy the vsftp service in Linux, and compile vsftp in linux.

Source: Internet
Author: User

Compile and deploy the vsftp service in Linux, and compile vsftp in linux.

DeploymentVsftpService

 

Hostname

OS

IP

Software

Vsftpsvr

RHEL-5.8

10.0.0.58

Yum install-y vsftpd

Yum install-y db4

 

Disable firewall: service iptables stop

Configure vsftpd service

[Root @ vsftpdsvr ~] # Yum install-y vsftpd // install the vsftpd package

[Root @ vsftpdsvr ~] # Mkdir-p/var/ftp/xuhao/sybg // create an ftp directory

Create a user and specify the home directory as the ftp directory

[Root @ vsftpdsvr ~] # Useradd-d/var/ftp/xuhao/-s/sbin/nologin xuhao

[Root @ vsftpdsvr ~] # Useradd-d/var/ftp/xuhao/sybg/-s/sbin/nologin xueyuan

[Root @ vsftpdsvr ~] # Passwd xuhao

[Root @ vsftpdsvr ~] # Passwd xueyuan

Set permissions for the ftp directory/var/ftp/xuhao. The owner is xuhao, the group is xueyuan, and the permission is 735

[Root @ vsftpdsvr ~] # Chown-R xuhao. xueyuan/var/ftp/xuhao/

[Root @ vsftpdsvr ~] # Chmod-R 735/var/ftp/xuhao/

Modify the main configuration file of vsftpd. conf

[Root @ vsftpdsvr ~] # Vim/etc/vsftpd. conf

Anonymous_enable = YES // Allow Anonymous Access

Local_enable = YES // allow local access

Write_enable = YES // write permission allowed

Enable vsftpd

[Root @ vsftpdsvr ~] #/Etc/init. d/vsftpd start

Starting vsftpd for vsftpd: [OK]

Verify

 

 

 

Build vsftpd service based on virtual users

Create a virtual user name/Password Database (/etc/vsftpd/vusers. list)

[Root @ vsftpdsvr ~] # Touch/etc/vsftpd/vusers. list

User1

12345

User2

123456

Install the db_load tool to convert it to a DB database file.

[Root @ vsftpdsvr ~] # Yum install-y db4

[Root @ vsftpdsvr ~] # Db_load-T-t hash-f/etc/vsftpd/vusers. list/etc/vsftpd/vusers. db

[Root @ vsftpdsvr ~] # File/etc/vsftpd/vusers. db

/Etc/vsftpd/vusers. db: Berkeley DB (Hash, version 8, native byte-order)

Create the FTP root directory and the system account corresponding to the virtual user

[Root @ vsftpdsvr ~] # Mkdir-p/var/ftp2

[Root @ vsftpdsvr ~] # Useradd-d/var/ftp2/-s/sbin/nologin virtual

[Root @ vsftpdsvr ~] # Chown-R virtual/var/ftp2/

[Root @ vsftpdsvr ~] # Chmod-R 777/var/ftp2 // modify directory permissions

Create a PAM Authentication file (/etc/pam. d/vsftpd. vu)

Auth required pam_userdb.so db =/etc/vsftpd/vusers

Auth required pam_userdb.so db =/etc/vsftpd/vusers

Modify the main configuration file of vsftpd. conf and add virtual user support

[Root @ vsftpdsvr ~] # Vim/etc/vsftpd. conf

Anonymous_enable = NO

Local_enable = YES

Pam_service_name = vsftpd. vu

Guest_enable = YES

Guest_username = virtual

User_config_dir =/etc/vsftpd/vusers_dir

Create independent configuration directories and files for users

[Root @ vsftpdsvr ~] # Mkdir/etc/vsftpd/user_dir

[Root @ vsftpdsvr ~] # Vim/etc/vsftpd/user_dir/user1

Anon_upload_enable = YES // upload allowed

Anon_mkdir_write_enable = YES // Folder creation allowed

Anon_other_wirte_enable = YES // allow deletion and rename

[Root @ vsftpdsvr ~] # Touch/etc/vsftpd/user_dir/user2

Restart vsftpd

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.