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:

<IfModule mod_tls.c>
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
</IfModule>
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:

<Anonymous ~ftp>
User ftp
Group nogroup

# We want clients to be able to login with "anonymous" as well as "ftp"
UserAlias anonymous ftp

# Cosmetic changes, all files belongs to ftp user
DirFakeUser on ftp
DirFakeGroup on ftp

RequireValidShell off

# Limit the maximum number of anonymous logins
MaxClients 10

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

# Limit WRITE everywhere in the anonymous chroot
<Directory *>
<Limit WRITE>
DenyAll
</Limit>
</Directory>
</Anonymous>
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"

【Raspberry pi】set up an ftp server的更多相关文章

  1. 【转】【Raspberry Pi】Unix NetWork Programming:配置unp.h头文件环境

    一.初衷 近期正在做网络计算编程的作业.要求平台为unix/linux,想着Raspberry Pi装的Debian系统也是Linux改的,也应该能够勉强用着,所以就用它来做作业了! 二.说明 先把环 ...

  2. 【Raspberry Pi】新入手的Raspberry Pi3拼装日志

    一.概述 2016年暑假某宝入手Raspberry Pi 3,装机清单: 树莓派主板 亚克力外壳 小风扇 散热片 30G SD card 螺丝若干颗 因机型问题,可能与你的机器有微小差异 二.装机过程 ...

  3. 【Raspberry Pi】USB无线网卡自动连接

    Raspberry Pi 使用USB无线网卡的时候不会因为路由重启而掉线. #!/bin/bash while true ; do if ifconfig wlan0 | grep -q " ...

  4. 【Raspberry Pi】修改时区

    Raspberry Pi没有时钟模块,所以每次断电都会丢失时间,但它有联网获取时间的预设.但要修改默认时区 http://outofmemory.cn/code-snippet/2899/shumei ...

  5. 【Raspberry pi】系统安装及基础配置

    1.系统安装 见官网:http://www.raspberrypi.org/quick-start-guide 2.基础配置 转载自http://www.eeboard.com/bbs/thread- ...

  6. 【Raspberry pi】cpu、内存等查看及扩展

    使用树莓派时,需要在其系统中部署几个不同功能的程序系统,并涉及到数据库读写.串口读写.web访问等,使系统使用压力较大,在查看树莓派使用情况时也遇到些许问题. free命令 total used fr ...

  7. 【Raspberry Pi】crontab 定时任务

    在linux上做定时任务一般用crond 两种方法上文已列,但昨天写的crond命令却一直都没有运行,上网查,有说是环境变量的,也有说是时间问题的,都改过,但还没有效. 今天再次认真读了一遍cront ...

  8. 【Raspberry Pi】定时运行python程序读温湿度传感器数据&发邮件

    1.定时执行脚本 http://tech.it168.com/a2011/0707/1214/000001214830_all.shtml /sbin/service crond start //启动 ...

  9. 【Raspberry Pi】DHT11 温度湿度传感器数据读取

    时序图参考厂家说明书:DHT11数字湿温度传感器的原理和应用范例 四个阵脚连接:VCC接3.3伏电源,Dout接GPIO口,我接的是物理12针脚,NC留空,GND接地. 波折1:电阻被错接进了VCC, ...

随机推荐

  1. C++11 std::async 包装实体店::packaged_task

    更好的方式 C++11中提供了操作多线程的高层次特性. std::packaged_task 包装的是一个异步操作,相当与外包任务,好比我大阿里把电话客服外包给某某公司. std::future 提供 ...

  2. 【OpenGL基础篇】——使用面向对象方法封装OpenGL函数(二)

    今天封装了一个Line类.负责在昨天写的窗体上绘制线条. OpenGL画图是通过给glBegin函数设置參数达成的,绘制线条有三个不同的參数: GL_LINES : 绘制连接两个点的线段(绘制的端点位 ...

  3. Sphinx-PHP使用Sphinx搜索技术

    Sphinx继承到PHP程序中, 有两种方式: Sphinx PHP模块: 编译生成PHP扩展模块 Sphinx API类: 直接使用Sphinx提供的类即可 首先我们应该使用Sphinx做以下几件事 ...

  4. 关于nodejs中npm命令没有反应的解决方法

    最近在学习angularJS,正在做一个单页面应用,在安装nodejs之后,发现命令行传了输入npm -v能输出结果外,其余npm的任何操作都没有反应,一开始我以为是下载的比较慢,等了半小时还是没动静 ...

  5. C#7.0之元组数据

    static (string,string,string) LookupName(int a) { return ("","",""); } ...

  6. C# EF使用性能消耗列表 https://msdn.microsoft.com/zh-cn/library/cc853327.aspx

    性能注意事项(实体框架) .NET Framework (current version)   其他版本   本主题介绍 ADO.NET 实体框架的性能特征,并提供一些注意事项帮助改善实体框架应用程序 ...

  7. Eclipse - JAR包制作

    Eclipse - JAR包制作细节   1.Jar包分为两种,一种是不可运行的,一种是可运行的Jar包,他们的主要区别如下:     > 不可直接运行的Jar包主要是用于给别的程序提供调用   ...

  8. jquery中ajax的相关事件汇总

    Jquery ajax事件分类 (一) 局部事件 local events 局部事件:在单个Ajax请求对象中绑定的事件,每个 Ajax 请求对象能够依据须要绑定自己的局部事件 .局部事件仅仅会被那个 ...

  9. Python Kivy 安装问题解决

    Fix: Running this was suggested by @matham in #3889 and solves the problem described below:python -m ...

  10. II7.5配置IIS支持2G文件下载

    IIS默认支持下载在20M让IIS7.5支持大文件下载,有两个地方 1.打IIS管理器->asp->点限制属性+->设置最大请求实体主体限制为2147483648 2.打开路径C:\ ...