ID:   密码:   验证码:  
我的知识库
服务器-WEB服务器
服务器-FTP服务器
服务器-安全防护
IDC业务相关
网络编程-ASP
网络编程-PHP
网络编程-.NET
网络编程-XML
数据库-Access
数据库-Mssql
数据库-Mysql
主机相关问题
域名相关问题
邮局相关问题
付款相关问题
相关文本合同
游戏技术-传奇私服架设
游戏技术-传奇脚本信息
游戏技术-传世私服
常用软件下载
首页 >> 我的知识库>>服务器-FTP服务器>> Linux 下如何利用proftpd构架一个ftp服务器  
Linux 下如何利用proftpd构架一个ftp服务器
[ 作者:  | 文章来源: 服务器技术 | 点击数: 538 | 更新时间: 2007-10-13 17:42:17 ]

这篇文章针对那些希望利用ftp协议和朋友们共享文件的人们,就像windows下的FTPserU,我提供的方式不是唯一的,希望我的方法足够清晰。这个FTPserver只允许拥有正确密码的人使用,所以你要明白只有已知的用户才能读取你的FTP服务。

Www_Spdns_com

1- 使用下面的命令安装proftpd:

Spdns~com

Code:

中国.南通服务器网

sudo apt-get install proftpd

Spdns_com

2- 在etc/shells 加入如下代码 (sudo gedit /etc/shells to open the file)(译注:命令行模式下sudo vi /etc/shells): 南通服务器网

Code: Spdns

/bin/false Spdns

新建一个 /home/FTP-shared 目录: [南通服务器网]

Code: Spdns^com

cd /home 南通服务器网

sudo mkdir FTP-shared

Spdns~com

创建一个只能用来读取ftp的用户userftp。这个用户不需要有效的shell(更安全),所以选择 /bin/false shell 给 userftp,/home/FTP-shared 作为主目录。

南通服务器网

为了是这部分更清楚,我给取此操作的命令行: [南通服务器网]

Code: Www.Spdns.com

sudo useradd userftp -p your_password -d /home/FTP-shared -s /bin/false Www~Spdns~com

在FTP-shared 目录下新建一个download和一个upload 目录:

南通服务器网

Code:

中国南通服务器网

cd /home/FTP-shared/ Www_Spdns_com

sudo mkdir download Www^Spdns^com

sudo mkdir upload

Spdns@com

现在我们来给它们设置相应的权限:

Www_Spdns_com

Code: 中国南通服务器网

cd /home Www@Spdns@com

sudo chmod 755 FTP-shared

中.国南通服务器网

cd FTP-shared

Spdns^com

sudo chmod 755 download 中.国.南通服务器网

sudo chmod 777 upload

Www@Spdns@com

3- 好了,现在进入proftpd的配置文件: Www.Spdns.com

以下为引用的内容:

Code: Www_Spdns_com

sudo gedit /etc/proftpd.conf

Spdns^com

当然你可以按你的需要编辑你自己的proftpd.conf:

Spdns.com

Code:
# To really apply changes reload proftpd after modifications.
AllowOverwrite on
AuthAliasOnly on

南通服务器网

# Choose here the user alias you want !!!!
UserAlias sauron userftp Spdns@com

ServerName "ChezFrodon"
ServerType standalone
DeferWelcome on

Www@Spdns@com

MultilineRFC2228 on
DefaultServer on
ShowSymlinks off

中国南通服务器网

TimeoutNoTransfer 600
TimeoutStalled 100
TimeoutIdle 2200

Spdns~com

DisplayFirstChdir .message
ListOptions "-l"

Spdns

RequireValidShell off 南通服务器网

TimeoutLogin 20 Www^Spdns^com

RootLogin off Spdns.com

# It's better for debug to create log files ;-)
ExtendedLog /var/log/ftp.log
TransferLog /var/log/xferlog
SystemLog /var/log/syslog.log

南通服务器网

#DenyFilter \*.*/

Spdns.com

# I don't choose to use /etc/ftpusers file (set inside the users you want to ban, not useful for me)
UseFtpUsers off

Www~Spdns~com

# Allow to restart a download
AllowStoreRestart on

中.国.南通服务器网

# Port 21 is the standard FTP port, so don't use it for security reasons (choose here the port you want)
Port 1980 Www^Spdns^com

# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd)
MaxInstances 8 中.国.南通服务器网

# Set the user and group that the server normally runs at.
User nobody
Group nogroup

Spdns^com

# Umask 022 is a good standard umask to prevent new files and dirs
# (second parm) from being group and world writable.
Umask 022 022

中国南通服务器网

PersistentPasswd off

中国南通服务器网

MaxClients 8
MaxClientsPerHost 8
MaxClientsPerUser 8
MaxHostsPerUser 8

Www~Spdns~com

# Display a message after a successful login
AccessGrantMsg "welcome !!!"
# This message is displayed for each access good or not
ServerIdent on "you're at home" 南通服务器网

# Set /home/FTP-shared directory as home directory
DefaultRoot /home/FTP-shared

Spdns

# Lock all the users in home directory, ***** really important *****
DefaultRoot ~

Www_Spdns_com

MaxLoginAttempts 5 Spdns^com

#VALID LOGINS

AllowUser userftp
DenyALL
中.国.南通服务器网


Umask 022 022
AllowOverwrite off

DenyAll

Www.Spdns.com


Umask 022 022
AllowOverwrite off

DenyAll

中国南通服务器网

/home/FTP-shared/upload/>
Umask 022 022
AllowOverwrite on

DenyAll

[南通服务器网]


AllowAll

中.国.南通服务器网

Spdns~com

好了,你已经完成了proftpd的配置,你的服务端口是1980,而读取的参数如下,用户:sauron,密码:你为userftp设置的那个。 Www@Spdns@com

4- 启动/停止/重启动你的服务: 中国.南通服务器网

Code:

中.国南通服务器网

sudo /etc/init.d/proftpd start Spdns@com

sudo /etc/init.d/proftpd stop Www^Spdns^com

sudo /etc/init.d/proftpd restart

中国.南通服务器网

对你的proftpd进行一下语法检查:

中国南通服务器网

Code: 中国南通服务器网,为中文网南通服务器网

想知道谁现在连接到你的服务,用ftptop命令(使用字母"t"来转换显示频率),你也可以使用"ftpwho"命令。

中国南通服务器网

Tags:Linux proftpd 构架 ftp服务器
责任编辑:阿小



评论
收藏
推荐
打印
关闭
字体:+ -
纠错


Copyright © 1999-2007 诚信 合法 规范的南通服务器网 www.spdns.com 始建于1996
企业总机:400-618-5529(只收市话费) 未开通400地区:0513-83015999 / 84012988 / 84519829
上海亿流数码科技有限公司 地址:江苏省南通市如东电信局大楼3楼IDC运维部
《中华人民共和国增值电信业务经营许可证》沪B2-20060518号
信息产业部备案编号:苏ICP备05009350号
电子执照:沪企3102272090823