Installation and configuration of FTP server (Ubuntu)
1. Query whether to install VSFTPD:RPM-QA |grep vsftpd
(RPM Installation: Apt-get install RPM)
or query the current FTP process: Ps-ef|grep vsftpd
2. Install VSFTPD server: RPM-IVH vsftpd-*.rpm or search for corresponding resources from the Internet directly install Vsftpd:apt-get install VSFTPD
++++++++++++++++++++++++++++
You can install the package online by configuring Yum.
[Root@szmspv1 yum.repos.d]# pwd
/etc/yum.repos.d
[Root@szmspv1 yum.repos.d]# more Rhel54.repo
[Server]
name=red Hat Enterprise Linux Server
baseurl=ftp://172.26.0.11/server64/
Enabled=1
Gpgcheck=1
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-redhat-release
+++++++++++++++++++++++++++++++++++++++++++++++++
3. Test
Root@localhost root:~# ftp localhost
Connected to localhost.
2.2.2 (VSFTPD)
Name (localhost:root): root
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
Ftp>bye
221 Goodbye.
4.VSFTPD server start, stop, reboot, status
Service vsftpd start or./etc/init.d/vsftpd Start
Service vsftpd stop or./etc/init.d/vsftpd stop
Service vsftpd restart or./etc/init.d/vsftpd restart
Service VSFTPD status or./ETC/INIT.D/VSFTPD status
5.VSFTPD of three primary configuration files
/etc/vsftpd.conf//server's main configuration file
/etc/ftpd.ftpusers//Users in this file will not be able to access the VSFTPD server
/etc/vsftpd.user_list//May be denied access to the service yell or allow access
Configuration parameters for 6.vsftpd.conf
Anonymous_enable=yes//Enable anonymous users
Local_enable=yes//allows local users to access VSFTPD servers
Write_enable=yes//Allow upload
Download_enable=yes//Allow download
Anon_upload_enable=yes//Allow anonymous users to upload
Anon_mkdir_write_enable=yes//Allow anonymous users to create directories and uploads
Anon_other_write_enable=no//Do not allow anonymous users to delete and rename
local_max_rate=20000//per second local user's maximum transfer rate, in bytes/sec
anon_max_rate=5000//Anonymous user's maximum transfer rate, in bytes per second
local_umask=022//Remove Write permission
file_open_mode=0666//permission to upload files
Xferlog_enable=yes//maintenance log files, detailed record upload and download operations
The Xferlog_std_format=yes//transfer log file will be written in a standard xferlog format, with the log file silently
Think/var/log/xferlog
Hide_ids=yes//hidden folders and directories owner
Port_enable=yes//Allow active transfer mode
Pasv_min_port= (1024<port<65535)//Specify the minimum port that PASV mode can use
Pasv_max_port= (1024<port<65535)//Specify the maximum port that PASV mode can use
Connect_from_port_20=yes//defines the port on which FTP transmits data, by default 20
Ascii_download_enable=no//settings not available in ASCII mode download
Listen=yes//Let FTP work in standalone mode
PAM_SERVICE_NAME=VSFTPD//User profile Authentication
Userlist_enable=yes
Tcp_wrappers=yes//will use wrappers as host access control mode
idle_session_timeout=600//Indicates idle time is 600 seconds
DATA_CONNECTION_TIMEOUT=120//Indicates data connection timeout of 120 seconds
Chroot_local_user=yes//user cannot access files or directories other than their own directory after logging in
listen_port=4444//Modify the port number of the FTP server
7. Set the FTP server to run automatically at 3, 5 levels
Chkconfig--level 3 5 vsftpd on
8.FTP customer connection Common failure phenomenon
Phenomenon 0:
> Ftp:connect: Connection denied
Reason: Service not started
Resolution: # Chkconfig VSFTPD on
Phenomenon 1:
Oops:cannot Open User list file
Reason: There is no file "/etc/vsftpd.user_list" or the account does not exist in the file
Resolution: # echo Username >>/etc/vsftpd.user_list
Phenomenon 2:
530 Permission denied.
Login failed.
Reason: The current login user is not present in the "/etc/vsftpd.user_list" file
Resolution: # echo Username >>/etc/vsftpd.user_list
Phenomenon 3:
Oops:cannot Open chroot () user list file
Login failed.
Reason: There is no file "/etc/vsftpd.chroot_list"
Resolution: # echo Username >>/etc/vsftpd.chroot_list
Phenomenon 4:
oops:missing value in config file
Connection closed by remote host.
Reason: "=" the value before the equal sign is problematic, or there is only one space
FIX: Correct the corresponding value, you may have a diff to compare find
Phenomenon 5:
Oops:bad bool value in config file
Connection closed by remote host.
Cause: "=" The value after the equals sign has a problem
Resolve: Confirm the change after the "=" equals sign
Phenomenon 6:
oops:unrecognised variable in config file
Connection closed by remote host.
Reason: There are spaces before parameters
Resolve: Remove the blank before the parameter
Phenomenon 7,
Verify that "Local_enable=yes" exists but local users cannot log on
Reason: Validation parameter was mistakenly deleted
Workaround: Add "pam_service_name=vsftpd"
Phenomenon 8,
Oops:chdir
Oops:child died
Connection closed by remote host.
Reason: The owner directory does not have permissions or no home directory
Workaround: Set user home directory permissions correctly
9.VSFTPD Virtual user Account setup steps
(1). Establish a virtual user password library file
Vi/pub/vu_list.txt
Wang5
123
Zhao6
456
(2). Generate VSFTPD Certification files
Db_load-t-T Hash-f/pub/vu_list.txt/etc/vsftpd/vu_list.db
chmod 600/etc/vsftpd/vu_list.db
(3). Establish the PAM profile required by the virtual user
Vi/etc/pam.d/vsftpd.vu
Auth required/lib/security/pam_userdb.so db=/etc/vsftpd/vu_list
Account Required/lib/security/pam_userdb.so Db=/etc/vsftpd/vu_list
(4). Set up directories to be accessed by virtual users and set appropriate permissions
Useradd Ftpuser
(5). Set up vsftpd.conf configuration file
Guest_username=ftpuser
Pam_service_name=vsftpd.vu
(6). Restart VSFTPD Server
Service VSFTPD Restart
10. Set different permissions on virtual users
(1). Set up vsftpd.conf file
User_config_dir=/etc/vsftpd_vu
(2). Create a table of contents
Mkdir/etc/vsftpd_vu
(3). Enter directory for editing
Cd/etc/vsftpd_vu
VI Wang5
Anon_world_readable_only=no
Anon_upload_enable=yes
Anon_mkdir_write_enable=yes
Anon_other_write_enable=yes
VI Zhao6
Anon_world_readable_only=yes
Anon_upload_enable=no
Anon_mkdir_write_enable=no
Anon_other_write_enable=no
10. Configure an ip-based virtual FTP server
(1). Bind other IP
Ifconfig eth0:0 192.168.1.71
(2). Set up virtual FTP server directory
Mkdir-p/var/ftp2/pub1
(3). Local user mapped by the anonymous user who created the virtual server
Ftp2
useradd-d/var/ftp2-m FTP2
(4). Modify the configuration file of the original standalone run server
listen_address=192.168.1.70
(5). Copy the primary configuration file for the build virtual server
Cp/etc/vsftpd.conf/etc/vsftpd/vsftpd2.conf
(6). Set the IP of the virtual server and map the anonymous user of the virtual server to the local user FTP2
Vi/etc/vsftpd/vsftpd2.conf
Pam_service_name=vsftpd
listen_address=192.168.1.71
Ftp_username=ftp2
(7). Restart Service Effective: Services VSFTPD restart
Use FTP command under DOS:
1. Switch to the specified directory
2. Connection Target FTP server: FTP 10.137.97.29
3. Enter account number, password
4. Switch transmission mode, binary transmission using bin command
5. Upload file: Put Test_setup.zip
Download file: Get **.zip
6. Exit Ftp:bye
7. CD Switch Directory
8. del Delete file
9. Dir View the remote host current directory
ASCII transfers files using ASCII
Mput, Mget: Upload and download multiple files
MkDir creates a directory in a remote host
PWD Displays the current working directory path for the remote host