Proftpd權(quán)限的設(shè)置原理
ProFTPD是繼Wu-FTP之后最為流行的FTP服務(wù)器軟件。Proftpd的權(quán)限都需要設(shè)置才能穩(wěn)定運(yùn)行,本文給大家介紹下他的原理!
一、測(cè)試平臺(tái)
Debian 4.0r3
Proftpd 1.3.1 (WITH SSL)
二、原理簡介
1、 繼承性
子目錄會(huì)繼承其父目錄的屬性。
2、 優(yōu)先級(jí)
優(yōu)先級(jí)由大到小的順序:
原始FTP命令(LIST DELE等) > 命令組(DIRS READ WRITE) > ALL命令組
3、 訪問控制的應(yīng)用順序
不論出現(xiàn)順序如何,先應(yīng)用拒絕(Deny),后應(yīng)用允許(Allow)
4、系統(tǒng)權(quán)限
Linux系統(tǒng)權(quán)限仍然起作用。如果設(shè)置了目錄test的
讀權(quán)限,這是該用戶就不能向test目錄寫入。
AllowUser u1 -------------------- 3、訪問控制的應(yīng)用順序
DenyAll
一點(diǎn)解釋:根據(jù)參考1所述,訪問控制的順序應(yīng)該是與其出現(xiàn)順序有關(guān),但是在我的測(cè)試中發(fā)現(xiàn)出現(xiàn)順序沒有什么影響。也就是說,像上面的訪問控制,AllowUser u1和DenyAll哪個(gè)在前面都一樣。
三、實(shí)例
1、簡介
假設(shè)proftpd服務(wù)器上有5個(gè)用戶:
manager, manA1, manA2, manB1, manB2
和2個(gè)組:
groupA, groupB
manA1和manA2屬于groupA組,manB1和manB2屬于groupB組。
并且有如下目錄結(jié)構(gòu):
- /根目錄
- │
- ├ftproot/
- │ ├m(xù)anager/
- │ │
- │ ├groupA/
- │ │ ├A1/
- │ │ ├A2/
- │ │ └.../
- │ │
- │ ├groupB/
- │ ├B1/
- │ ├B2/
- │ └.../
- │
- └.../
現(xiàn)在要實(shí)現(xiàn)的權(quán)限:
1、用戶manager可以讀寫manager、groupA、groupB目錄及它們的的子目錄。
2、manA1可以讀寫A1目錄,并且可以讀寫groupB的所有子目錄。
3、manA2可以讀寫A2目錄,并且可以讀寫groupB的所有子目錄。
4、manB1可以讀寫B(tài)1目錄。
5、manB2可以讀寫B(tài)2目錄。
6、如果一個(gè)用戶沒有某個(gè)目錄的訪問權(quán)限,那么該用戶就不能看到此目錄。
7、只允許manger用戶和groupA、groupB組成員訪問FTP服務(wù)器。
8、不允許任何人破壞主干目錄結(jié)構(gòu)
2、實(shí)現(xiàn)
(1)添加用戶和組
useradd manager
passwd manager
groupadd groupA
groupadd groupB
useradd manA1
passwd manA1
usermod -G groupA manA1
useradd manA2
passwd manA2
usermod -G groupA manA2
useradd manB1
passwd manB1
usermod -G groupB manB1
useradd manB2
passwd manB2
usermod -G groupB manB2
#p#
(2)配置文件
- # This is a basic ProFTPD configuration file (rename it to
- # 'proftpd.conf' for actual use. It establishes a single server
- # and a single anonymous login. It assumes that you have a user/group
- # "nobody" and "ftp" for normal operation and anon.
ServerName "Formax BPO FTP Server"
ServerType standalone
DefaultServer on
# Port 21 is the standard FTP port.
Port 21
UseReverseDNS off
IdentLookups off# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 000
- # 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 under which the server will run.
User nobody
Group nogroup
- # To cause every FTP user to be "jailed" (chrooted) into their home
- # directory, uncomment this line.
- # DefaultRoot ~
DefaultRoot /ftproot
# Normally, we want files to be overwriteable.
AllowOverwrite on
AllowStoreRestart on
ServerIdent off
TLSEngine on
TLSLog /var/ftpd/tls.log
TLSProtocol SSLv23
# Are clients required to use FTP over TLS when talking to this server?
TLSRequired on
# Server's certificate
TLSRSACertificateFile /etc/proftpd.cert
TLSRSACertificateKeyFile /etc/proftpd.key
# CA the server trusts
TLSCACertificateFile /etc/proftpd.cert
# Authenticate clients that want to use FTP over TLS?
TLSVerifyClient off
TLSOptions NoCertRequest
- # Allow SSL/TLS renegotiations when the client requests them, but
- # do not force the renegotations. Some clients do not support
- # SSL/TLS renegotiations; when mod_tls forces a renegotiation, these
- # clients will close the data connection, or there will be a timeout
- # on an idle data connection.
TLSRenegotiate required off
# Bar use of SITE CHMOD by default
通過閱讀全文,我們知道了Proftpd權(quán)限的設(shè)置原理,希望對(duì)大家有所幫助!
【編輯推薦】