---
title: "ftp 配置"
author: "jickcai"
date: "2023-12-05T10:06:50Z"
tags: []
categories: ["Web前端"]
slug: "ftp"
draft: false
lastmod: "2023-12-05T10:06:50Z"
id: 2539620
url: "https://jickcai.iteye.com/blog/2539620"
---

#### 配置目录

/usr/local/proftp/etc/proftpd.passwd

#### 配置文件

 

/usr/local/proftp/etc/proftpd.conf

 

 

ServerName "ProFTPD"

ServerType standalone

DefaultServer on

 

timesGMT off

\# Port 21 is the standard FTP port.

Port 21

\# Umask 022 is a good standard umask to prevent new dirs and files

\# from being group and world writable.

Umask 022

IdentLookups off

UseReverseDNS off

\# 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 30

 

\# Set the user and group that the server normally runs at.

User nobody

Group nogroup

 

\# Normally, we want files to be overwriteable.

&lt;Directory /\*&gt;

AllowOverwrite on

&lt;/Directory&gt;

 

\# A basic anonymous configuration, no upload directories.

#&lt;Anonymous ~ftp&gt;

\# User ftp

\# Group ftp

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

\# UserAlias anonymous ftp

 

\# Limit the maximum number of anonymous logins

\# MaxClients 30

 

\# We want 'welcome.msg' displayed at login, and '.message' displayed

\# in each newly chdired directory.

\# DisplayLogin welcome.msg

 

\# Limit WRITE everywhere in the anonymous chroot

\# &lt;Limit WRITE&gt;

\# DenyAll

\# &lt;/Limit&gt;

#&lt;Directory /etc&gt;

\# &lt;Limit ALL&gt;

\# DenyAll

\# &lt;/Limit&gt;

#&lt;/Directory&gt;

#&lt;Directory /lib64&gt;

\# &lt;Limit ALL&gt;

\# DenyAll

\# &lt;/Limit&gt;

#&lt;/Directory&gt;

 

#&lt;Directory /lib&gt;

\# &lt;Limit ALL&gt;

\# DenyAll

\# &lt;/Limit&gt;

#&lt;/Directory&gt;

 

#&lt;Directory /bin&gt;

\# &lt;Limit ALL&gt;

\# DenyAll

\# &lt;/Limit&gt;

#&lt;/Directory&gt;

 

#&lt;Directory /sbin&gt;

\# &lt;Limit ALL&gt;

\# DenyAll

\# &lt;/Limit&gt;

#&lt;/Directory&gt;

 

#&lt;Directory /usr&gt;

\# &lt;Limit ALL&gt;

\# DenyAll

\# &lt;/Limit&gt;

#&lt;/Directory&gt;

 

#&lt;Directory /var&gt;

\# &lt;Limit ALL&gt;

\# DenyAll

\# &lt;/Limit&gt;

#&lt;/Directory&gt;

 

 

#&lt;Directory /home/\*&gt;

\# &lt;Limit LIST NLST&gt;

\# AllowAll

\# &lt;/Limit&gt;

#&lt;/Directory&gt;

 

 

#&lt;Directory /&gt;

\# &lt;Limit LIST NLST&gt;

\# DenyAll

\# &lt;/Limit&gt;

#&lt;/Directory&gt;

 

#&lt;Directory /opt&gt;

\# &lt;Limit LIST NLST&gt;

\# DenyAll

\# &lt;/Limit&gt;

#&lt;/Directory&gt;

 

#&lt;Directory /flash/&gt;

\# &lt;Limit LIST NLST&gt;

\# AllowAll

\# &lt;/Limit&gt;

#&lt;/Directory&gt;

 

\# &lt;Limit WRITE&gt;

\# DenyAll

\# &lt;/Limit&gt;

 

#&lt;/Anonymous&gt;

 

AuthOrder mod\_auth\_file.c

AuthUserFile /usr/local/proftp/etc/proftpd.passwd

RequireValidShell off

#### 命令

ftpasswd --file=/usr/local/proftp/etc/proftpd.passwd --home=/home/work/ftp --shell=/bin/false --name=work --uid=500 --gid=500 --passwd

--home=xxx 指定 ftp 用户登录后的根目录（eg. --home=/home/work）

--name=xxx 指定 ftp 用户名

--uid=500 --gid=500 指定账号关联对应系统用户和组（eg. 99:nobody/500:work 可通过命令 id work查看用户对应uid/gid）

下载

 

[ftpasswd](/admin/blogs/)

#### 重启FTP服务

service proftpd restart

 

cd /usr/local/proftp/sbin

./proftpd

 

 

 

 

 

 

&lt;iframe style="display: none !important;" width="320" height="240"&gt;&lt;/iframe&gt;

&lt;iframe style="display: none !important;" width="320" height="240"&gt;&lt;/iframe&gt;