设为首页 收藏本站
查看: 1151|回复: 0

【Raspberry pi】set up an ftp server

[复制链接]

尚未签到

发表于 2015-5-27 13:17:30 | 显示全部楼层 |阅读模式
  http://www.debian-administration.org/articles/228
  As a means of distributing large collections of files FTP is still a popular choice, despite the rise of bittorrent, and the growing number of HTTP servers.
  FTP is an often overlooked method of storing and giving access to files, in many cases FTP servers have been retired in place of webservers such as Apache.
  But there are a lot of cases where offering access via FTP makes sense, even with the limitations of FTP - most notably the difficulty of firewalling and the security risk involved in using plaintext passwords.
  There are several different FTP servers packaged within Debian, which you can see via:
  apt-cache search ftp-server
One of the most popular servers around is proftpd, and that can be installed upon Debian systems with:
  apt-get install proftpd
Once downloaded debconf will ask if you wish to run the server via inetd, or in a standalone fashion. In general you want the latter option.
  After the installation the server will be running, and will grant access to all user accounts upon the host.
  If you wish to stop the server prior to more configuration you can do so with:
  /etc/init.d/proftpd stop
The configuration of proftpd is conducted via the configuration file of /etc/proftpd.conf.
  Security Options
There are several security options you can enable in proftpd, the most notable is the use of TLS security.
  To use TLS you will need to generate a key, and update your server's configuration file to use it.
  Generating a key is simple enough with the openssl command, which is contained in the openssl package:
  mkdir /etc/proftpd
cd /etc/proftpd
openssl req -new -x509 -days 365 -nodes -out ftpd-rsa.pem \
   -keyout ftpd-rsa-key.pem
With the files generated you can add the following to your proftpd.conf file:
  
   TLSEngine on
   TLSLog /var/log/proftpd-tls.log
   TLSProtocol TLSv1
  # Are clients required to use FTP over TLS when talking to this server?
   TLSRequired off
  TLSRSACertificateFile    /etc/proftpd/ftpd-rsa.pem
   TLSRSACertificateKeyFile /etc/proftpd/ftpd-rsa-key.pem
   
   # Authenticate clients that want to use FTP over TLS?
   TLSVerifyClient off

Other security options include limiting users to particular directories. To limit the user "bob" to the starting directory "/tmp" you can use:
  DefaultRoot /tmp bob
The more general approach is to restrict users to their own home directory, which you can accomplish via:
  DefaultRoot ~
This causes all users to be presented with the contents of their home directory (as specified by /etc/passwd) when they login.
  Permitting Anonymous Access
To permit anonymous access to your server you will need to uncomment the configuration options which are already present in the standard /etc/proftpd.conf file.
  This is a good starting point:
  

   Userftp
   Groupnogroup
  # We want clients to be able to login with "anonymous" as well as "ftp"
   UserAliasanonymous ftp
  # Cosmetic changes, all files belongs to ftp user
   DirFakeUseron ftp
   DirFakeGroup on ftp

   RequireValidShelloff

   # Limit the maximum number of anonymous logins
   MaxClients10

   # We want 'welcome.msg' displayed at login, and '.message' displayed
   # in each newly chdired directory.
   DisplayLoginwelcome.msg
   DisplayFirstChdir.message

   # Limit WRITE everywhere in the anonymous chroot
   
     
       DenyAll
     
   

This configuration setting allows users to login with either anonymous, or ftp, as username and they will be able to read from /home/ftp.
  Thankfully they will be unable to upload new content, or delete existing files. They will be given only read-only access to the server.
  Miscallaneous Options
There are some other options which you might wish to change, for example the welcome message presented to clients.
  The welcome message presented is read from /home/ftp/welcome.msg, editing that file will immediately change the text sent to users.
  The hostname of your server is typically displayed to clients when they connect - in the Debian package the greeting only includes the string "Debian" - as you can see from the following session:
  user@host:~ ftp localhost
Connected to localhost.localdomain.
220 ProFTPD 1.2.10 Server (Debian) [127.0.0.1]
To change this update the proftpd.conf file to include:
  ServerName "My.host.name"

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-71259-1-1.html 上篇帖子: 通过FTP命令上传下载 下篇帖子: wininet实现ftp客户端关于传输进度的分析
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表