Linux伺服器配置---ftp限制ip
ftp限制IP
1、通過vsftpd的配置檔案以及“hosts.deny”和“hosts.allow”檔案設定允許某個ip地址訪問
1)修改配置檔案“/etc/vsftpd/vsftpd.conf”中的引數“tcp_wrapper”,確保這個引數是yes
|
2)開啟配置檔案“/etc/hosts.deny“,在末尾追加一句話”vsftpd:all:Deny
|
3)開啟配置檔案“/etc/hosts.allow“,在末尾追加一句話”vsftpd:192.168.0.123:Allow
“。當前的配置就是隻允許“192.168.0.123”訪問
|
4)測試是否可以訪問,當前主機的ip並不是“192.168.0.123”,因此訪問不會成功的
|
2、當一個ip地址對主機的連線太多時,就會降低伺服器的效率。因此有必要設定一個IP的連線數,當連線超過一定的數量就不能再連了,這樣就可以提高伺服器的效率。Vsftpd預設沒有連線設定,可以通過引數“max_clients“來設定。由於同一個區域網的ip是一樣的,因此這個最大連線數要合理設定。
1)開啟配置檔案“/etc/vsftpd/vsftpd.conf“,在末尾追加一句話”max_clients=2“
|
2)重啟服務,測試。一次開啟三個連線,發現第三個連線不能訪問
|
做了一個Linux學習的平臺,目前出來一個雛形,各位可以參考使用
連結:https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ 密碼:n7bk