Linux FTP build tutorial, linuxftp build tutorial

Source: Internet
Author: User

Linux FTP build tutorial, linuxftp build tutorial

I. Install the ftp service

Set IP Address

Attach a cd

Disable iptables Firewall

Disable selinux/[root @ localhost ~] # Setenforce 0

[Root @ localhost ~] # Cd/media/cdrom/Packages/

[Root @ localhost Packages] # rpm-ivh vsftpd-2.2.2-11.el6_4.1.x86_64.rpm

Ii. ftp service based on system users

1: anonymous access to the ftp service

1): Create a test file for ftp download.

[Root @ localhost ~] # Tar zcf/var/ftp/vsftpdconf.tar.gz/etc/vsftpd/

[Root @ localhost ~] # Chown ftp/var/ftp/pub/\ pub belongs to anonymous user ftp

2): enable Anonymous user configuration and start vsftpd service

[Root @ localhost ~] # Vi/etc/vsftpd. conf

12 anonymous_enable = YES \ Anonymous Users are allowed

15 local_enable = NO \ do not enable local users

18 write_enable = YES \ write allowed

23 anon_umask = 022 \ add, permission mask for data upload

27 anon_upload_enable = YES \ Allow Anonymous File Upload

31anon_mkdir_write_enable = YES \ Allow anonymous users to create directories

[Root @ localhost ~] # Service vsftpd start

[Root @ localhost ~] # Netstat-anpt | grep "vsftpd"

3): linux client Testing

[Root @ localhost ~] # Cd/media/cdrom/Packages/

[Root @ localhost Packages] # rpm-ivh ftp-0.17-54.el6.x86_64.rpm \ install client Tool

[Root @ localhost Packages] # ftp 192.168.10.10 \ name: use ftp and Password at will

Ftp> ls

Ftp> LCD/opt \ switch the local directory to/opt, and the data downloaded from ftp will be stored in the local/opt directory.

Ftp> get vsftpdconf.tar.gz

Ftp> LCD/root

Ftp> cd pub

Ftp> put install. log

[Root @ localhost ~] # Wget ftp: // 192.168.10.10/vsftpdconf.tar.gz

2: User-verified ftp service

1): Configure Local User Authentication

[Root @ localhost ~] # Vi/etc/vsftpd. conf

15 local_enable = yes

18 write_enable = YES

22 local_umask = 077

96 chroot_local_user = YES

[Root @ localhost ~] # Service vsftpd start

[Root @ localhost ~] # Useradd zhangsan

[Root @ localhost ~] # Passwd zhangsan

[Root @ localhost ~] # Useradd lisi

[Root @ localhost ~] # Passwd lisi

2): client Verification

[Root @ localhost ~] # Ls> uptest.txt

[Root @ localhost ~] # Ftp 192.168.10.10

Log On with the account and password of zhangsan and lisi

Ftp> put uptest.txt \ is uploaded to the/home/zhangsan directory of Michael Jacob.

Ftp> quit

3): Use the user_list user list file

[Root @ localhost ~] # Vi/etc/vsftpd/user_list

Add only zhangsan, and delete all others

Zhangsan

[Root @ localhost ~] # Vi/etc/vsftpd. conf

118 userlist_enable = YES

119 userlist_deny = no \ add

[Root @ localhost ~] # Service vsftpd restart

Use zhangsan and lisi for login verification respectively

3: Other configurations

1): Modify the listening address and port

[Root @ localhost ~] # Vi/etc/vsftpd. conf

110 listen = YES

111listen_address = 192.168.10.10 \ add listening address

112 listen_port = 2121 \ add listening port

[Root @ localhost ~] # Service vsftpd restart

2): client Test

[Root @ localhost ~] # Ftp 192.168.10.10 2121

3): Use the ftp passive mode.

123 pasv_enable = yes

124 pasv_min_port = 24500

125 pasv_max_port = 24600

[Root @ localhost ~] # Service vsftpd restart

Iii. ftp service based on virtual users

1: create an account database for a virtual user

1): create a user name and password list in text format

[Root @ localhost ~] # Vi/etc/vsftpd/vusers. list

Add

Mike

Aptech

Wjq

Aptech

2): create database files in the berkeley DB format

[Root @ localhost ~] # Cd/etc/vsftpd/

[Root @ localhost vsftpd] # db_load-T-t hash-f vusers. list vusers. db

[Root @ localhost vsftpd] # file vusers. db

Vusers. db: Berkeley DB (Hash, version 9, native byte-order)

[Root @ localhost vsftpd] # chmod 600/etc/vsftpd/vusers .*

[Root @ localhost vsftpd] # ls-lh/etc/vsftpd/vusers .*

3): Add a ing account for a virtual user and a common ftp root directory

[Root @ localhost vsftpd] # useradd-d/var/ftproot-s/sbin/nologinvirtual

[Root @ localhost vsftpd] # chmod 755/var/ftproot/

[Root @ localhost vsftpd] #

2: Add virtual user support for the vsftpd service

1): Create a PAM Authentication file for the virtual user

[Root @ localhost vsftpd] # vi/etc/pam. d/vsftpd. vu

Auth required pam_userdb.sodb =/etc/vsftpd/vusers

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

2): Modify vsftpd and add virtual user support

[Root @ localhost vsftpd] # vi/etc/vsftpd. conf

Delete

112 listen_port = 2121

118 userlist_enable = YES

119 userlist_deny = no

Add

15 local_enable = yes

18 write_enable = YES

23anon_umask = 022

118pam_service_name = vsftpd. vu \ add

120 guest_enable = yes \ add

121 guest_username = virtual \ add

3): create independent configuration files for different virtual users

[Root @ localhost vsftpd] # vi/etc/vsftpd. conf

122user_config_dir =/etc/vsftpd/vusers_dir \ add

[Root @ localhost vsftpd] # mkdir/etc/vsftpd/vusers_dir/

[Root @ localhost vsftpd] # cd/etc/vsftpd/vusers_dir/

[Root @ localhost vusers_dir] # vi mike

Add

Anon_upload_enable = yes

Anon_mkdir_write_enable = yes

[Root @ localhost vusers_dir] # touch wjq

[Root @ localhost vusers_dir] # service vsftpd restart

4): use both mike and wjq for Logon verification.

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.