本地用戶
1. 修改ftp配置文件,linux
anonymous_enable=NO 默認爲YES,修改成NO,禁止匿名訪問,web
監聽端口,能夠根據本身的需求修改,爲了安全起見自定義爲好算法
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
2. /etc/vsftpd/ftpusers 禁止列表服務器端vsftpd服務爲了讓FTP服務更加的安全,默認禁止以root身份登入數據庫
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
3.服務器端安全
![](http://static.javashuo.com/static/loading.gif)
4.關閉防火牆,重啓ftp服務,登陸測試服務器
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
2、ftp虛擬用戶登陸session
1.創建虛擬FTP用戶數據庫文件。
服務器端,切換目錄cd /etc/vsftpd/app
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
2. 使用db_load命令用HASH算法生成FTP用戶數據庫文件vuser.db並查看文件tcp
![](http://static.javashuo.com/static/loading.gif)
3. FTP用戶數據庫內容很敏感,因此權限給小一些測試
![](http://static.javashuo.com/static/loading.gif)
4.建立用戶virtual並設置爲不容許登錄系統並定義該用戶的家目錄
爲保證其餘用戶能夠訪問,給予權限
![](http://static.javashuo.com/static/loading.gif)
5.創建支持虛擬用戶的PAM認證文件,參數db用於指向剛剛生成的vuser.db文件,但不要寫後綴。
![](http://static.javashuo.com/static/loading.gif)
6.在vsftpd.conf文件中添加支持配置
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
7.爲虛擬用戶設置不一樣的權限。
如今不管是linuxprobe仍是blackshield賬戶,他們的權限都是相同的——默認不能上傳、建立、修改文件,若是但願用戶blackshield可以徹底的管理FTP內的資料,就須要讓FTP程序支持獨立的用戶權限配置文件了。 建立用戶獨立的權限配置文件存放的目錄:mkdir /etc/vsftpd/vusers_dir/
切換進入到該目錄中:cd /etc/vsftpd/vusers_dir/
建立空白的linuxprobe的配置文件
![](http://static.javashuo.com/static/loading.gif)
8.重啓vsftpd服務,驗證明驗效果。
![](http://static.javashuo.com/static/loading.gif)
9.服務器端設置SELinux
![](http://static.javashuo.com/static/loading.gif)
10.客戶端登陸ftp並驗證
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
ftp服務器匿名用戶設置
匿名用戶在服務器端映射到ftp用戶下
/一、主配置文件:/etc/vsftpd/vsftpd.conf 刪除默認配置增長如下內容:
客戶端只能下載~:
anonymous_enable=YES
no_anon_password=YES 匿名登陸系統不檢測密碼,一般是email
anon_max_rate=1000000 最大帶寬10M
data_connection_timeout=60 超時60s
idle_session_timeout=600 發呆超過10分鐘斷線
max_clients=50 最大鏈接數及每一個IP可用鏈接
max_per_ip=5
local_enable=NO
use_localtime=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=YES
pam_service_name=vsftpd
tcp_wrappers=YES
banner_file=/etc/vsftpd/anon_welcome.txt
讓匿名用戶能夠上傳/下載資料(權限開放最大)上一個配置文件後面增長:
write_enable=YES
anon_other_write_enable=YES
anon_mkdir_write_enable=YES
anon_upload_enable=YES
改文件夾權限:
mkdir /var/ftp/uploads
chown ftp /var/ftp/uploads
還要修改seLinux:
setsebool -P ftpd_anon_write=on
setsebool -P ftpd_full_access=on
讓匿名用戶具備上傳權限,不能下載(實際應用案例:經審覈才能下載),上傳以後就在客戶端看不見了
write_enable=YES
anon_mkdir_write_enable=YES
anon_upload_enable=YES
chown_uploads=YES
chown_username=daemon 將上傳文件全部者改成daemon因此沒法下載