Cloud Computing Learning Route course outline Courseware: FTP Server
Cloud Computing Learning Route course outline Courseware: FTP Serve
Important index 2 stars
Function: to provide file sharing services
=
I. Foundation of FTP
FTP: file transfer protocol
Software package: vsftpd
FTP port: control port command 21/tcp
Dataport data 20/tcp (active mode)
Configuration file: / etc/vsftpd/vsftpd.conf
II. Default configuration of vsftpd
FTP Server
= = centos6==
[root@tianyun ~] # yum-y install vsftpd
[root@tianyun ~] # service vsftpd restart
[root@tianyun ~] # chkconfig vsftpd on
SELinux
[root@tianyun ~] # sed-ri'/ ^ SELINUX=/cSELINUX=disabled' / etc/selinux/config
[root@tianyun ~] # setenforce 0
Iptables [temporary shutdown]
[root@tianyun] # iptables-F
[root@tianyun ~] # service iptables save
= = centos7==
[root@iZwz9f17um10wphrf38ni8Z ~] # cat / etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@iZwz9f17um10wphrf38ni8Z ~] # yum-y install vsftpd
[root@iZwz9f17um10wphrf38ni8Z ~] # touch / var/ftp/yang.txt
[root@iZwz9f17um10wphrf38ni8Z ~] # systemctl start vsftpd
[root@iZwz9f17um10wphrf38ni8Z ~] # systemctl enable vsftpd
The default firewalld/SELinux is turned off, if not:
[root@aliyun] # firewall-cmd-- permanent-- add-service=ftp
[root@aliyun] # firewall-cmd-- reload
[root@aliyun ~] # sed-ri'/ ^ SELINUX=/cSELINUX=disabled' / etc/selinux/config
[root@aliyun ~] # setenforce 0
FTP default shared directory: / var/ftp
FTP Clinet:
Lftp
[root@tianyun ~] # yum-y install lftp
[root@tianyun ~] # lftp zhufo.top
Lftp zhufo.top:~ > ls
Drwxr-xr-x 20 0 4096 Mar 31 2016 pub
-rw-r--r-- 1000 Nov 22 03:53 yang.txt
Lftp zhufo.top:/ > get yang.txt
Lftp zhufo.top:/ > mirror pub
Wget
[root@tianyun ~] # wget-- help | less
[root@tianyun ~] # wget ftp://10.18.40.100/kvm-manager-centos
[root@tianyun] # wget ftp://10.18.40.100/kvm-manager-centos-P / tmp/
[root@tianyun ~] # wget ftp://10.18.40.100/kvm-manager-centos-O / tmp/a.sh
[root@tianyun ~] # wget / / nginx.org/download/nginx-1.10.2.tar.gz
[root@tianyun] # wget-m ftp://zhufo.top/soft
Curl
Firefox,IE
[root@tianyun ~] # lftp alice@zhufo.top
Password:
Lftp alice@zhufo.top:~ > ls
-rw-r--r-- 1 0 1523 Nov 22 04:25 alice.txt
Lftp alice@zhufo.top:~ > pwd
Ftp://alice@zhufo.top/%2Fhome/alice
Lftp alice@zhufo.top:~ > put / etc/hosts
Anonymous user ftp is used by default, HOME is / var/ftp, and only files can be downloaded by default
System user: alice,HOME / home/alice, downloading and uploading by default
=
3. Basic configuration, such as implementing access control.
Note: spaces in instructions, instruction errors, instruction repeats
[root@tianyun ~] # vim / etc/vsftpd/vsftpd.conf
Anonymous_enable=YES / / whether to allow anonymous users to log in to ftp
Local_enable=YES / / whether to allow local users to log in to alice
Write_enable=YES / / whether to allow writing (global)
Local_umask=022 / / controls the default permissions for local users to upload files. Umask indicates the permissions to be reduced.
Anon_umask=077 / / controls the default permissions for anonymous users to upload files
Chroot: lock local user HOME
Method 1: some users chroot
Chroot_list_enable=YES
Chroot_list_file=/etc/vsftpd/chroot_list
Method 2: all local users chroot
Chroot_local_user=YES
Anon_max_rate=500000 / / anonymous user speed limit
Local_max_rate=80000 / / Speed limit for local users
Max_clients=500 / / ftp maximum number of connections
Max_per_ip=2 / / maximum number of connections / threads per IP
Local_root=/ftproot / / specifies the root directory accessed by the local user
Anon_root=/anonroot / / specifies the root directory accessed by anonymous users
Case 1: using FTP to share YUM sources
Server:
[root@yangs ~] # mkdir / var/ftp/ {centos6u8,centos7u3}
[root@yangs] # mount-o loop / home/centos7u3.iso / var/ftp/centos7u3
[root@yangs ~] # echo "mount-o loop / home/centos7u3.iso / var/ftp/centos7u3" > > / etc/rc.local
[root@yangs ~] # chmod + x / etc/rc.d/rc.local
Client:
[root@tianyun ~] # vim / etc/yum.repos.d/centos7.repo
[centos7u3]
Name=centos7u3
Baseurl= ftp://10.18.40.100/centos7u3
Gpgcheck=0