您好,登錄后才能下訂單哦!
這篇文章主要講解了“ubuntu服務器安裝proftpd ftp服務器的詳細過程”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“ubuntu服務器安裝proftpd ftp服務器的詳細過程”吧!
一、安裝
代碼如下:
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.
# 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 # 服務器運行在nobody用戶下
Group nobody # 服務器運行在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 # 默認新建文件的權限
# 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 # 系統運行日志
<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 href="http://security.lss.hr/index.php?page=details&ID=LSS-2004-10-02">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 # 以下部分為設置用戶權限部分
<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>
四、啟動、停止、重啟服務器
代碼如下:
sudo /etc/init.d/proftpd start
sudo /etc/init.d/proftpd stop
sudo /etc/init.d/proftpd restart
五、維護
可以到/var/log/proftpd目錄查看日志
查看ftp服務器負載命令 ftptop
查看什么認登陸服務器 ftpwho
PS:proftpd中Limit的使用介紹
我們用到的比較多的可能是Limit的使用,Limit大致有以下動作,基本能覆蓋全部的權限了。
CMD:Change Working Directory 改變目錄
MKD:MaKe Directory 建立目錄的權限
RNFR: ReName FRom 更改目錄名的權限
DELE:DELEte 刪除文件的權限
RMD:ReMove Directory 刪除目錄的權限
RETR:RETRieve 從服務端下載到客戶端的權限
STOR:STORe 從客戶端上傳到服務端的權限
READ:可讀的權限,不包括列目錄的權限,相當于RETR,STAT等
WRITE:寫文件或者目錄的權限,包括MKD和RMD
DIRS:是否允許列目錄,相當于LIST,NLST等權限,還是比較實用的
ALL:所有權限
LOGIN:是否允許登陸的權限
針對上面這個Limit所應用的對象,又包括以下范圍
AllowUser 針對某個用戶允許的Limit
DenyUser 針對某個用戶禁止的Limit
AllowGroup 針對某個用戶組允許的Limit
DenyGroup 針對某個用戶組禁止的Limit
AllowAll 針對所有用戶組允許的Limit
DenyAll 針對所有用戶禁止的Limit
關于限制速率的參數為:
TransferRate STOR|RETR 速度(Kbytes/s) user 使用者
感謝各位的閱讀,以上就是“ubuntu服務器安裝proftpd ftp服務器的詳細過程”的內容了,經過本文的學習后,相信大家對ubuntu服務器安裝proftpd ftp服務器的詳細過程這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。