搭建 CentOS 6 服务器(9) - vsftpd、ProFTPD

本文详细介绍了vsftpd与ProFTPD两种FTP服务的安装与配置过程,包括用户管理、权限设置及服务启动等内容,并提供了客户端工具推荐。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[b](一)vsftpd[/b]

安装
# yum -y install vsftpd
Installed:
vsftpd.i686 0:2.2.2-12.el6_5.1


设置
# cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.backup
# vi /etc/vsftpd/vsftpd.conf
# 不允许匿名用户登录
anonymous_enable=NO
# 设置空闲时间
idle_session_timeout=300
# 设置链接超时时间
data_connection_timeout=30
# 允许上传下载
ascii_upload_enable=YES
ascii_download_enable=YES
# 登陆后的欢迎词
ftpd_banner=Welcome to Myvsftpd FTP service.
# 不允许一般用户访问上层文件夹
chroot_local_user=YES
chroot_list_enable=YES
# 可以访问上层文件夹的用户一览
chroot_list_file=/etc/vsftpd/chroot_list
# 允许删除文件夹
ls_recurse_enable=YES
# 只允许「/etc/vsftpd/user_list」内的用户访问
userlist_enable=NO


用户设置
# vi /etc/vsftpd/chroot_list
root
# /usr/sbin/useradd ftpuser1 -d /home/ftpuser1 -G nobody
# passwd ftpuser1
New password: 123456
Retype new password: 123456
passwd: all authentication tokens updated successfully.
# vi /etc/vsftpd/user_list
ftpuser1
# vi /etc/hosts.allow
vsftpd : 192.168.21. 127.0.0.1
# vi /etc/hosts.deny
vsftpd : ALL


启动服务
# /etc/rc.d/init.d/vsftpd start


[b](二)ProFTPD[/b]

下载安装
# cd /usr/local/src
# wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.5.tar.gz
# tar xvfz proftpd-1.3.5.tar.gz
# cd proftpd-1.3.5
# ./configure --enable-nls --prefix=/usr/local/proftpd
# make
# make install


创建用户
# cd /usr/local/proftpd/bin
# /usr/sbin/useradd ftpuser1 -d /home/ftpuser1 -G nobody
# passwd ftpuser1
New password: 123456
Retype new password: 123456
passwd: all authentication tokens updated successfully.


做成私有密码文件
# id ftpuser1
# ./ftpasswd --passwd --file=/usr/local/proftpd/etc/ftpd.passwd --name=ftpuser1 \
--uid=502 --gid=502 --home=/home/ftpuser1 --shell=/bin/bash
ftpasswd: using alternate file: /usr/local/proftpd/etc/ftpd.passwd
ftpasswd: creating passwd entry for user ftpuser1

Password:111111
Re-type password:111111

ftpasswd: entry created
# ./ftpasswd --group --file=/usr/local/proftpd/etc/ftpd.group \
--name=ftpuser1 --gid=502
ftpasswd: using alternate file: /usr/local/proftpd/etc/ftpd.group
ftpasswd: creating group entry for group ftpuser1
ftpasswd: entry created


设置
# cp /usr/local/proftpd/etc/proftpd.conf /usr/local/proftpd/etc/proftpd.conf.bak
vi /usr/local/proftpd/etc/proftpd.conf
ServerName "Welcome to MyProFTPD FTP service."
Group nobody
DefaultRoot ~
注释掉「<Anonymous ~ftp>」 到 「</Anonymous>」
ExtendedLog /var/log/proftp.log all

<Directory />
HideFiles ^\..*
</Directory>

AuthUserFile /usr/local/proftpd/etc/ftpd.passwd
AuthGroupFile /usr/local/proftpd/etc/ftpd.group
AuthOrder mod_auth_file.c

MaxClientsPerHost 2
MaxClients 20

PathAllowFilter \.(jpg|gif|png|jpeg)$
MaxStoreFileSize 3 Mb

ListOptions -a maxfiles 1000


启动脚本
# cd /usr/local/src/proftpd-1.3.5/contrib/dist/rpm
# cp proftpd.init.d /etc/init.d/proftpd
# vi /etc/init.d/proftpd
# chmod +x /etc/init.d/proftpd


启动服务
# /etc/init.d/proftpd start


[b]FTP确认测试[/b]
C:\Documents and Settings\RenSanNing>ftp

连接
ftp> op
To 192.168.21.xxx
Connected to 192.168.21.xxx.
220 Welcome to MyProFTPD FTP service.
User (192.168.21.xxx:(none)): ftpuser1
331 Please specify the password.
Password:
230 Login successful.

变更文件夹
ftp> pwd
257 "/"
ftp> cd /root/
550 Failed to change directory.
ftp> cd /etc/
550 Failed to change directory.

上传文件
ftp> put c:\test.txt
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 Transfer complete.
ftp: 7 bytes sent in 0.00Seconds 7000.00Kbytes/sec.

确认文件
ftp> ls -l
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r--r-- 1 503 503 7 Aug 20 11:51 test.txt
226 Directory send OK.
ftp: 66 bytes received in 0.00Seconds 66000.00Kbytes/sec.

下载文件
ftp> get test.txt
200 PORT command successful. Consider using PASV.
150 Opening ASCII mode data connection for test.txt (7 bytes).
226 Transfer complete.
ftp: 7 bytes received in 0.00Seconds 7000.00Kbytes/sec.

ftp> bye
221 Goodbye.

[b]客户端工具:[/b]
FFFTP:[url=http://sourceforge.jp/projects/ffftp/]http://sourceforge.jp/projects/ffftp/[/url]
FileZilla:[url=https://filezilla-project.org/]https://filezilla-project.org/[/url]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值