网站运营
位置:首页>> 网站运营>> Linux 下如何利用proftpd构架一个ftp服务器

Linux 下如何利用proftpd构架一个ftp服务器

 来源:服务器技术 发布时间:2007-10-11 14:52:00 

标签:

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

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

Code:

sudo apt-get install proftpd

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

Code:

/bin/false

新建一个 /home/FTP-shared 目录:

Code:

cd /home

sudo mkdir FTP-shared

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

为了是这部分更清楚,我给取此操作的命令行:

Code:

sudo useradd userftp -p your_password -d /home/FTP-shared -s /bin/false

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

Code:

cd /home/FTP-shared/

sudo mkdir download

sudo mkdir upload

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

Code:

cd /home

sudo chmod 755 FTP-shared

cd FTP-shared

sudo chmod 755 download

sudo chmod 777 upload

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


           

Code:

sudo gedit /etc/proftpd.conf

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

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

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

ServerName   "ChezFrodon"
ServerType    standalone
DeferWelcome   on

MultilineRFC2228 on
DefaultServer   on
ShowSymlinks   off

TimeoutNoTransfer 600
TimeoutStalled 100
TimeoutIdle 2200

DisplayFirstChdir               .message
ListOptions                 "-l"

RequireValidShell   off

TimeoutLogin 20

RootLogin    off

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

#DenyFilter   \*.*/

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

# 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

# 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

# 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

# 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

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

MaxLoginAttempts    5

#VALID LOGINS
<Limit LOGIN>
AllowUser userftp
DenyALL
</Limit>

<Directory /home/FTP-shared>
Umask 022 022
AllowOverwrite off
 <Limit MKD STOR DELE XMKD RNRF RNTO RMD XRMD>
 DenyAll
 </Limit>
</Directory>

<Directory /home/FTP-shared/download/*>
Umask 022 022
AllowOverwrite off
 <Limit MKD STOR DELE XMKD RNEF RNTO RMD XRMD>
 DenyAll
 </Limit>
</Directory>

<Directory> /home/FTP-shared/upload/>
Umask 022 022
AllowOverwrite on
 <Limit READ RMD DELE>
       DenyAll
     </Limit>

     <Limit STOR CWD MKD>
       AllowAll
     </Limit>
</Directory>

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

4- 启动/停止/重启动你的服务:

Code:

sudo /etc/init.d/proftpd start

sudo /etc/init.d/proftpd stop

sudo /etc/init.d/proftpd restart

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

Code:

sudo proftpd -td5

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

0
投稿

猜你喜欢

  • 百度已成长成为具有垄断优势的全球性搜索引擎。简单的结论是,如果你的网站在百度上不能获得良好的排名,那么你的网络营销策略就算是失败。有关研究表
  • 人总是愿意用挑剔的眼光来看到新生事物,在对待刀片服务器的问题就是如此,有些人对于一些反复介绍的技术视而不见,仍然强加给刀片服务器一些莫须有的
  • 百度搜索引擎12月2日开始了本月首次索引数据库更新,直到12月5日才结束了大更新行动,本次更新历行5天时间。本次更新显然与以往都不同。我在这
  • 由天极网、解放日报网、ITBEAR、中国站长、WEB开发网、Donews等国内知名网络媒体联合评测推荐以及根据国内知名域名虚拟主机服务商华夏
  • PHPWind v7.3.2收藏夹分页链接错误问题解决方法:打开mode/o/m_article.php查找:$pages =&n
  • 至今为止用了将近半年WP,折腾过不少功能,所以对它还算是略有些了解,所以就用这几篇文章来详细的写一下基础的一些WP优化操作。工欲善其事,必先
  • 查看记录文件是很乏味的。记录文件令人厌恶,包含了太多的信息,经常使人非常头疼。幸运的是,这些枯燥的工作有代劳者,利用一些日志分析工具,不仅可
  • 谈到网络安全,你可能熟悉网页欺诈的危险,但是知道域欺骗(pharming)威胁吗?对于一家在线公司来说,这种风险是致命的!简单来说,域欺骗就
  • 11月26日,天涯社区宣布推出最新的企业空间产品和ADTOP广告系统,以期提升盈利的规模。七天连锁酒店、京东商城等数十家知名企业已经入驻天涯
  • 最近百度又变了,算法又改变了一点。我记得一位朋友说过一句话,很经典,我还是那样,记住了意思,没有记住话。意思是说,百度评价一个站发生了很大的
  • 核心提示:10天后,我的网站出现在搜索结果的第九页上。这也给我上了关于SEO的最后一课:一切都需要耐心。我很讨厌在搜索页面的前几位看到自己写
  • 据国外媒体报道,微软董事会主席比尔·盖茨(Bill Gates)周二表示,互联网技术将在今后十年发生巨大变革。盖茨是在受韩国总统李明博接见时
  • 齐毛鸭在使用dedecms时发现,每一个栏目的列表页的title是不能直接优化的。举个例子,某栏目的名字是“文学天地”,但在title中我们
  • 什么是友情链接,友情链接的作用和好处: 友情链接是一种网站之间的简单合作形式,即分别在自己的网站上以文字、图片或其他形式的载体链接到对方的网
  • 虽然雅虎和GOOGLE对反向链接和链接文本采取了完全不同的处理方式,但即使是对雅虎优化来说,链接文本(Link/Anchor Text)仍然
  • 一个网站的用户体验高低是由页面各元素的设计决定的,如表单、网页文字、功能等。网页文字是网页中所占分量最大的要素,所以其设计得好坏直接整个页面
  • Win2000操作系统的一个主要特色就是将IIS融入其内核之中,并提供一些用来配置和维护软件的向导工具,使构建一个Internet网站轻松易
  • 有时在博客评论和论坛里看到有朋友说我们写的SEO技巧不够具体,感觉无从下手,这样的问题经常让分享技巧的人也有点无奈,不知道该具体到什么程度。
  • 一、 IIS6.0综述IIS 6.0在Windows2003服务器的四种版本&ldquo;企业版、标准版、数据中心版和Web版&am
  • 对于作Google AdSense的站长来说,注意自己的帐号安全,是非常重要的。可是由于Google对于站长在哪个网站放广告代码,没有一个所
手机版 网站运营 asp之家 www.aspxhome.com