Recently ready to put windows on the FTP stop, since mindedly learn CentOS right there is also the need, then learn to build an FTP service good, just practice.
Rpm-qa |grep vsftp #查看本机是否安装了ftp服务
If the installation is not installed by using a command.
Yum Install-y vsftpd
The installation is complete using the FTP service to start and set it to boot up:
The FTP configuration file is then modified and the file is located in/etc/vsftpd/vsftpd.conf
Chkconfig vsftpd onservice vsftpd start
# example config file /etc/vsftpd/vsftpd.conf 2 # 3 # The default compiled in settings are fairly paranoid. This sample file 4 # loosens things up a bit, to make The ftp daemon more usable. 5 # please see vsftpd.conf.5 for all compiled in defaults. 6 # 7 # read THIS: This example file is NOT an exhaustive list of vsftpd options. 8 # please read the vsftpd.conf.5 manual Page to get a full idea of vsftpd ' S 9 # capabilities. 10 # 11 # Allow anonymous FTP? (Beware - allowed by default if you comment this out) . 12 anonymous_enable=yes 13 # 14 # Uncomment this to allow local users to log in. 15 local_ enable=yes 16 # 17 # uncomment this to enable any form Of ftp write command. 18 write_enable=yes 19 # 20 # default umask for local users is 077. you may wish to change this to 022, 21 # if your users expect that (022 IS USED BY MOST OTHER FTPD ' s) 22 local_umask=022 23 # 24 # Uncomment this to allow the anonymous FTP user to Upload files. this only 25 # has an effect if the above global write Enable is activated. also, you will 26 # obviously need to create a directory writable by the FTP user. 27 # Allow anonymous users to upload operations 28 anon_upload_enable=YES 29 # 30 # Uncomment this If you want the anonymous ftp user to be able to create 31 # new directories. 32 # can create folders with anonymous users 33 #anon_mkdir_ write_enable=yes 34 31 # new directories. 32 # Folder creation can be done through anonymous users 33 #anon_mkdir_write_enable =yes 34 35 #可以通过匿名用户进行删除文件操作 36 #anon_other_write_enable =yes 37 # 38 # activate directory messages - messages given to remote users when they 39 # go into a certain d irectory. 40 dirmessage_enable=yes 41 # 42 # the name of log file when xferlog_enable=yes and xferlog_std_format=yes 43 # Warning - changing this filename affects /etc/logrotate.d/vsftpd.log 44 xferlog_file=/var/log/vsftpd.log 45 # 46 # the target log file can be vsftpd_log_file or xferlog_file. 47 # This depends On setting xferlog_std_format parameter 48 xferlog_enable=yes 49 # 50 # switches between logging into vsftpd_log_file and xferlog_file files. 51 # no writes to vsftpd_log_file, yes to xferlog_ file 52 xferlog_std_format=yes 53 # 54 # make sure port Transfer connections originate from port 20 (Ftp-data) . 55 connect_from_port_20=yes 56 # 57 # if you want, you can arrange for uploaded anonymous files to be owned by 58 # a different user. note! Using "Root" for uploaded files is not 59 # recommended! 60 #chown_uploads =yes 61 #chown_username =whoever 62 # 63 # you may change the default value for timing out an idle session. 64 #idle_session_timeout =600 65 # 66 # you may change the default value for timing out a data connection. 67 #data_connection_timeout =120 68 # 69 # it is recommended that you define on youR system a unique user which the 70 # ftp server can use as a totally isolated and unprivileged user. 71 #nopriv _user=ftpsecure 72 # 73 # enable this and the server will recognise asynchronous abor requests. not 74 # recommended for security (the code is non-trivial). not enabling it, 75 # however, may confuse older FTP clients. 76 #async_abor_enable =yes 77 # 78 # By default the server will pretend to allow ascii mode but in fact ignore 79 # the request. Turn on the below options to have the server actually do ascii 80 #&nbsP;mangling on files when in ascii mode. 81 # beware that on some FTP servers, ASCII support allows a denial of service 82 # attack (DoS) via the command "Size /big/file" In ascii mode. vsftpd 83 # predicted this attack and has always been safe, reporting the size of the 84 # raw file. 85 # ascii mangling is a horrible feature of the protocol. 86 #ascii_upload_enable =yes 87 #ascii_download_enable =yes 88 # 89 # You may fully customise the login banner string: 90 #ftpd_banner =welcome to blah ftp service. 91 # 92 # you may specify a file of disallowed anonymous e-mail addresses. apparently 93 # useful for combatting certain DoS attacks. 94 #deny_email_ enable=yes 95 # (default follows) 96 #banned_email_file =/etc/vsftpd/banned_ Emails 97 # 98 # you may specify an explicit list of local users to chroot () to their home 99 # directory. if chroot_local_user is yes, then this list becomes a list Of100 # users to not chroot () .101 chroot_local_user=yes102 #chroot_list_ enable=yes103 # (default follows) 104 #chroot_list_file =/etc/vsftpd/chroot_list105 # 106 # you may activate the "-R" option to the builtin Ls. this is disabled by107 # default to avoid remote users being able to Cause excessive i/o on large108 # sites. however, some broken FTP clients such as "ncftp" and "Mirror" assume109 # the presence of the "-R" option, so there is a strong case for enabling it.110 #ls_recurse_enable =yes111 #112 # When "Listen" directive is enabled, vsftpd runs in standalone mode and113 # listens on ipv4 sockets. this directive cannot be used in conjunction114 # with the listen_ipv6 directive.115 listen=yes116 #117 # this directive enables listening on ipv6 sockets. to listen on ipv4 and IPv6118 # sockets, you must run two copies of Vsftpd with two configuration files.119 # make sure, that one of the listen options is commented !! 120 #listen_ipv6 =yes121 122 pam_service_name=vsftpd123 userlist_enable=yes124 userlist_deny=no125 #userlist_enable with Userlist_deny to take effect, deny is yes when users in the UserList file cannot log in to FTP, Instead, only allow users in the file to log in ftp126 tcp_wrappers=yes127 #max_clients =300128 #设置同时访问FTP的最大客户端数量129 #max_ per_ip=10130 #设置单个IP地址同时连接FTP服务的最大数
Restart the VSFTPD service when Setup is complete
Service VSFTPD Restart
To create an FTP login User:
useradd-d/ftp/ftpuser/-s/sbin/nologin ftpuser #创建用户, set the startup directory to/ftp/ftpuser, the default shell is/sbin/nologin ( Because the default user is not allowed to log on to the Linux system) echo "passwd" |passwd--stdin ftpuser #设置ftpuser用户密码为passwd
The Userlist_deny=no option is used in the profile 124 row, whether the anonymous user anonymous is enabled or not, you will need to configure the User_list file in the/etc/vsftpd/directory if you need to log in. Join the user who needs to log in to the FTP server.
You can log in by adding the previously added Ftpuser user to the User_list file.
A more simple FTP server is set up, check the online some information that the FTP verification process is clear text of the security will be poor, and then slowly add it, first meet the needs of subsequent changes (mainly not yet understand the encryption O (╯-╰) o).
This article from "Product small stream, into Jianghai" blog, please be sure to keep this source http://goodjoe.blog.51cto.com/9173556/1771256
CentOS Build FTP Server