ubuntu服務(wù)器安裝proftpd ftp服務(wù)器步驟

一、安裝
sudo apt-get install proftpd
安裝過程中會(huì)讓選擇運(yùn)行模式:Standalone和Inetd,前者是單一服務(wù)器模式,后者是超級(jí)服務(wù)器模式,
我選的Standalone。
二、配置
sudo vim /etc/shells
加入如下代碼
/bin/false
新建用戶ftpuser1和用戶組ftp并設(shè)置密碼,此用戶不需要有效的shell(更安全),所以選擇/bin/false
給fptuser1
sudo groupadd ftp
sudo useradd ftpuser1 -p pass -g ftp -d /home/ftp -s /bin/false
在/home/ftp目錄下新建upload和download目錄并修改權(quán)限
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" # 修改服務(wù)器名
ServerType standalone # 服務(wù)器運(yùn)行模式,這里填standalone,也可以選
inetd
DeferWelcome on # 用戶登陸時(shí)是否顯示歡迎信息
MultilineRFC2228 on
DefaultServer on
ShowSymlinks on
TimeoutNoTransfer 600
TimeoutStalled 600 # 可以降到100
TimeoutIdle 1200 # 發(fā)呆超時(shí)
DisplayLogin welcome.msg # 如果上邊DeferWelcom設(shè)置成on,則顯示
welcome.msg中的內(nèi)容
DisplayFirstChdir .message # 更改目錄時(shí)顯示的內(nèi)容
ListOptions "-l"
DenyFilter \*.*/
# Use this to jail all users in their homes
DefaultRoot /home/ftp # ftp用戶被限制在這個(gè)目錄中
# 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 # 服務(wù)運(yùn)行的端口
# 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.
# MasqueradeAddress 1.2.3.4
# 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 # 服務(wù)器運(yùn)行在nobody用戶下
Group nobody # 服務(wù)器運(yùn)行在nobody組下
# Umask 022 is a good standard umask to prevent new files and dirs
# (second parm) from being group and world writable.
Umask 022 022 # 默認(rèn)新建文件的權(quán)限
# Normally, we want files to be overwriteable.
AllowOverwrite on # 文件可以被覆蓋
# Uncomment this if you are using NIS or LDAP to retrieve passwords:
# PersistentPasswd off
# Be warned: use of this directive impacts CPU average load!
# Uncomment this if you like to see progress and transfer rate with ftpwho
# in downloads. That is not needed for uploads rates.
#
# UseSendFile off
# Choose a SQL backend among MySQL or PostgreSQL.
# Both modules are loaded in default configuration, so you have to specify the backend
# or comment out the unused module in /etc/proftpd/modules.conf.
# Use 'mysql' or 'postgres' as possible values.
#
#<IfModule mod_sql.c>
# SQLBackend mysql
#</IfModule>
TransferLog /var/log/proftpd/xferlog # 傳送文件日志
SystemLog /var/log/proftpd/proftpd.log # 系統(tǒng)運(yùn)行日志
<IfModule mod_tls.c>
TLSEngine off
</IfModule>
<IfModule mod_quota.c>
QuotaEngine on
</IfModule>
<IfModule mod_ratio.c>
Ratios on
</IfModule></p> <p># Delay engine reduces impact of the so-called Timing Attack described in
# <a >http://security.lss.hr/index.php?page=details&ID=LSS-2004-10-02</a>
# It is on by default.
<IfModule mod_delay.c>
DelayEngine on
</IfModule>
<IfModule mod_ctrls.c>
ControlsEngine on
ControlsMaxClients 2
ControlsLog /var/log/proftpd/controls.log
ControlsInterval 5
ControlsSocket /var/run/proftpd/proftpd.sock
</IfModule>
<IfModule mod_ctrls_admin.c>
AdminControlsEngine on
</IfModule>
# A basic anonymous configuration, no upload directories.
# <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>
#
# # Uncomment this if you're brave.
# # <Directory incoming>
# # # Umask 022 is a good standard umask to prevent new files and dirs
# # # (second parm) from being group and world writable.
# # Umask 022 022
# # <Limit READ WRITE>
# # DenyAll
# # </Limit>
# # <Limit STOR>
# # AllowAll
# # </Limit>
# # </Directory>
#
# </Anonymous>
# Valid Logins # 以下部分為設(shè)置用戶權(quán)限部分
<Limit LOGIN>
AllowUser ftpuser1
DenyAll
</Limit>
<Directory /home/ftp>
Umask 022 022
AllowOverwrite off
<Limit MKD STOR DELE XMKD RNRF RNTO RMD XRMD>
DenyAll
</Limit>
</Directory>
<Directory /home/ftp/download/>
Umask 022 022
AllowOverwrite off
<Limit MKD STOR DELE XMKD RNEF RNTO RMD XRMD>
DenyAll
</Limit>
</Directory>
<Directory /home/ftp/upload/>
Umask 022 022
AllowOverwrite on
<Limit READ RMD DELE>
DenyAll
</Limit>
<Limit STOR CWD MKD>
AllowAll
</Limit>
</Directory>
四、啟動(dòng)、停止、重啟服務(wù)器
sudo /etc/init.d/proftpd start
sudo /etc/init.d/proftpd stop
sudo /etc/init.d/proftpd restart
五、維護(hù)
可以到/var/log/proftpd目錄查看日志
查看ftp服務(wù)器負(fù)載命令 ftptop
查看什么認(rèn)登陸服務(wù)器 ftpwho
PS:proftpd中Limit的使用介紹
我們用到的比較多的可能是Limit的使用,Limit大致有以下動(dòng)作,基本能覆蓋全部的權(quán)限了。
CMD:Change Working Directory 改變目錄
MKD:MaKe Directory 建立目錄的權(quán)限
RNFR: ReName FRom 更改目錄名的權(quán)限
DELE:DELEte 刪除文件的權(quán)限
RMD:ReMove Directory 刪除目錄的權(quán)限
RETR:RETRieve 從服務(wù)端下載到客戶端的權(quán)限
STOR:STORe 從客戶端上傳到服務(wù)端的權(quán)限
READ:可讀的權(quán)限,不包括列目錄的權(quán)限,相當(dāng)于RETR,STAT等
WRITE:寫文件或者目錄的權(quán)限,包括MKD和RMD
DIRS:是否允許列目錄,相當(dāng)于LIST,NLST等權(quán)限,還是比較實(shí)用的
ALL:所有權(quán)限
LOGIN:是否允許登陸的權(quán)限
針對(duì)上面這個(gè)Limit所應(yīng)用的對(duì)象,又包括以下范圍
AllowUser 針對(duì)某個(gè)用戶允許的Limit
DenyUser 針對(duì)某個(gè)用戶禁止的Limit
AllowGroup 針對(duì)某個(gè)用戶組允許的Limit
DenyGroup 針對(duì)某個(gè)用戶組禁止的Limit
AllowAll 針對(duì)所有用戶組允許的Limit
DenyAll 針對(duì)所有用戶禁止的Limit
關(guān)于限制速率的參數(shù)為:
TransferRate STOR|RETR 速度(Kbytes/s) user 使用者
相關(guān)文章
新特性搶先看! Ubuntu 25.04 Beta 發(fā)布:Linux 6.14 內(nèi)核
Canonical公司近日發(fā)布了Ubuntu 25.04 Beta版,這一版本被賦予了一個(gè)活潑的代號(hào)——“Plucky Puffin”(勇敢的海雀),據(jù)悉,正式的穩(wěn)定版預(yù)計(jì)將在2025年4月17日與廣大用戶2025-03-29如何讓 Ubuntu 居中顯示窗口? 3種方法實(shí)現(xiàn)Ubuntu窗口居中顯示
個(gè)人習(xí)慣不管打開終端窗口還是文件管理器窗口,都希望居中顯示,不太喜歡Linux下自動(dòng)隨意的擺放位置,下面我們就來看看詳細(xì)設(shè)置方法2025-03-11Ubuntu 24.04.2 LTS 正式發(fā)布: 帶來全新硬件支持啟用堆棧HWE
buntu 24.04 LTS 的第 2 個(gè)小版本Ubuntu 24.04.2 LTS 正式發(fā)布,出了修復(fù)漏洞以外,它還帶來了全新的硬件支持啟用堆棧(HWE),讓系統(tǒng)性能和硬件兼容性更上一層樓2025-02-25怎么關(guān)閉Ubuntu無人值守升級(jí)? Ubuntu禁止自動(dòng)更新的技巧
Ubuntu Linux系統(tǒng)禁止自動(dòng)更新的時(shí)候,提示“無人值守升級(jí)在關(guān)機(jī)期間,請(qǐng)不要關(guān)閉計(jì)算機(jī)進(jìn)程”,該怎么解決這個(gè)問題?詳細(xì)請(qǐng)看下文介紹2025-01-20高效管理你的Linux系統(tǒng): Debian操作系統(tǒng)常用命令指南
在Debian操作系統(tǒng)中,了解和掌握常用命令對(duì)于提高工作效率和系統(tǒng)管理至關(guān)重要,本文將詳細(xì)介紹Debian的常用命令,幫助讀者更好地使用和管理Debian系統(tǒng)2025-01-20debian更新系統(tǒng)的命令怎么用? 輕松配置Debian自動(dòng)更新的技巧
Debian不手動(dòng)更新怎么體驗(yàn)新系統(tǒng)?Debian提供了一個(gè)既簡單又高效的解決辦法——自動(dòng)更新,該怎么用呢?詳細(xì)請(qǐng)看下文介紹2025-01-20如何配置Ubuntu無人值守升級(jí)? 手動(dòng)操作實(shí)現(xiàn)Ubuntu自動(dòng)升級(jí)技巧
無人值守升級(jí)是一個(gè)用于自動(dòng)更新 Debian 和 Ubuntu 系統(tǒng)的開源項(xiàng)目,該項(xiàng)目的主要目的是確保系統(tǒng)能夠定期自動(dòng)安裝安全更新,從而保持系統(tǒng)的安全性和穩(wěn)定性2025-01-20Ubuntu系統(tǒng)怎么安裝Warp? 新一代AI 終端神器安裝使用方法
Warp是一款使用Rust開發(fā)的現(xiàn)代化AI 終端工具,該怎么再Ubuntu系統(tǒng)中安裝使用呢?下面我們就來看看詳細(xì)教程2025-01-20Debian如何查看系統(tǒng)版本? 7種輕松查看Debian版本信息的實(shí)用方法
Debian是一個(gè)廣泛使用的Linux發(fā)行版,用戶有時(shí)需要查看其版本信息以進(jìn)行系統(tǒng)管理、故障排除或兼容性檢查,在Debian系統(tǒng)中,有幾種不同的方法可以查看版本信息2025-01-17解決VMware中Ubuntu虛擬機(jī)鼠標(biāo)閃爍或指針位置不正確的方案
剛下載虛擬機(jī)后,電腦在虛擬機(jī)內(nèi)出現(xiàn)了鼠標(biāo)閃爍或者鼠標(biāo)指針位置不對(duì)的問題,該怎么解決呢?下面我們就來看看詳細(xì)教程2025-01-09