您好,登錄后才能下訂單哦!
今天就跟大家聊聊有關(guān)Linux服務(wù)器中ftp如何限制ip,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。
限制IP
1、通過vsftpd的配置文件以及“hosts.deny”和“hosts.allow”文件設(shè)置允許某個ip地址訪問
1)修改配置文件“/etc/vsftpd/vsftpd.conf”中的參數(shù)“tcp_wrapper”,確保這個參數(shù)是yes
|
2)打開配置文件“/etc/hosts.deny“,在末尾追加一句話”vsftpd:all:Deny
“
|
3)打開配置文件“/etc/hosts.allow“,在末尾追加一句話”vsftpd:192.168.0.123:Allow
“。當(dāng)前的配置就是只允許“192.168.0.123”訪問
|
4)測試是否可以訪問,當(dāng)前主機(jī)的ip并不是“192.168.0.123”,因此訪問不會成功的
|
2、當(dāng)一個ip地址對主機(jī)的連接太多時,就會降低服務(wù)器的效率。因此有必要設(shè)置一個IP的連接數(shù),當(dāng)連接超過一定的數(shù)量就不能再連了,這樣就可以提高服務(wù)器的效率。Vsftpd默認(rèn)沒有連接設(shè)置,可以通過參數(shù)“max_clients“來設(shè)置。由于同一個局域網(wǎng)的ip是一樣的,因此這個最大連接數(shù)要合理設(shè)置。
1)打開配置文件“/etc/vsftpd/vsftpd.conf“,在末尾追加一句話”max_clients=2“
|
2)重啟服務(wù),測試。一次打開三個連接,發(fā)現(xiàn)第三個連接不能訪問
|
做了一個Linux學(xué)習(xí)的平臺,目前出來一個雛形,各位可以參考使用
鏈接:https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ 密碼:n7bk
看完上述內(nèi)容,你們對Linux服務(wù)器中ftp如何限制ip有進(jìn)一步的了解嗎?如果還想了解更多知識或者相關(guān)內(nèi)容,請關(guān)注億速云行業(yè)資訊頻道,感謝大家的支持。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。