ubuntu服务器安装proftpd ftp服务器步骤

2020-02-03 11:14:45丽君

一、安装


复制代码
sudo apt-get install proftpd

安装过程中会让选择运行模式:Standalone和Inetd,前者是单一服务器模式,后者是超级服务器模式,
我选的Standalone。

二、配置


复制代码
sudo vim /etc/shells

加入如下代码

复制代码
/bin/false

新建用户ftpuser1和用户组ftp并设置密码,此用户不需要有效的shell(更安全),所以选择/bin/false
给fptuser1

复制代码
sudo groupadd ftp
sudo useradd ftpuser1 -p pass -g ftp -d /home/ftp -s /bin/false

在/home/ftp目录下新建upload和download目录并修改权限

复制代码
cd /home/ftp
sudo mkdir download
sudo mkdir upload
cd /home
sudo chmod 755 ftp
cd /home/ftp
sudo chmod 755 download
sudo chmod 777 upload

三、修改proftpd核心配置文件proftpd.conf


复制代码
sudo vim /etc/proftpd/proftpd.conf
#
# /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file.
# To really apply changes reload proftpd after modifications.
#
# Includes DSO modules
Include /etc/proftpd/modules.conf
# Set off to disable IPv6 support which is annoying on IPv4 only boxes.
UseIPv6 off # 我们不需要IPv6,所以off
ServerName "xiaoyigeng's FTP Server" # 修改服务器名
ServerType standalone # 服务器运行模式,这里填standalone,也可以选
inetd
DeferWelcome on # 用户登陆时是否显示欢迎信息
MultilineRFC2228 on
DefaultServer on
ShowSymlinks on
TimeoutNoTransfer 600
TimeoutStalled 600 # 可以降到100
TimeoutIdle 1200 # 发呆超时
DisplayLogin welcome.msg # 如果上边DeferWelcom设置成on,则显示
welcome.msg中的内容
DisplayFirstChdir .message # 更改目录时显示的内容
ListOptions "-l"
DenyFilter *.*/
# Use this to jail all users in their homes
DefaultRoot /home/ftp # ftp用户被限制在这个目录中
# Users require a valid shell listed in /etc/shells to login.
# Use this directive to release that constrain.
# RequireValidShell off # 匿名用户要选on
# Port 21 is the standard FTP port.
Port 21 # 服务运行的端口
# In some cases you have to specify passive ports range to by-pass
# firewall limitations. Ephemeral ports can be used for that, but
# feel free to use a more narrow range.
# PassivePorts 49152 65534 # PASV模式下用到的端口
# If your host was NATted, this option is useful in order to
# allow passive tranfers to work. You have to use your public
# address and opening the passive ports used on your firewall as well.