成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

CentOS vsftpd制作虛擬用戶數據庫文件

系統 Linux
這里將原CentOS vsftpd.conf配置文件經過簡化后保存作為虛擬用戶配置文件的模版。這里將并不需要指定太多的配置內容,主要的框架和限制交由 CentOS vsftpd的主配置文件CentOS vsftpd.conf來定義,即虛擬用戶配置文件當中沒有提到的配置項目將參考主配置文件中的設定。
CentOS vsftpd還是比較常用的,于是我研究了一下CentOS vsftpd,在這里拿出來和大家分享一下,希望對大家有用。

制作虛擬用戶數據庫文件

1.先建立虛擬用戶名單文件:[root@KcentOS5 ~]# touch /etc/vsftpd/virtusers建立了一個虛擬用戶名單文件,這個文件就是來記錄CentOS vsftpd虛擬用戶的用戶名和口令的數據文件,我這里給它命名為virtusers。為了避免文件的混亂,我把這個名單文件就放置在/etc/vsftpd/下。

2.編輯虛擬用戶名單文件:

  1. [root@KcentOS5 ~]# vi /etc/vsftpd/virtusers   
  2. kanecruise  
  3. 123456  
  4. near  
  5. 123456near  
  6. mello  
  7. 123456mello 

編輯這個虛擬用戶名單文件,在其中加入用戶的用戶名和口令信息。格式很簡單:“一行用戶名,一行口令”。

3.生成虛擬用戶數據文件:

[root@KcentOS5 ~]# db_load T t hash f /etc/vsftpd/virtusers /etc/vsftpd/virtusers.db這里我順便把這個命令簡單說明一下察看db4的db_load命令使用方法:

  1. [root@KSRV2 vsftpd]# db_load  
  2. usage: db_load [nTV] [c name=value] [f file] [h home] [P password] [t btree | hash | recno | queue] db_file  
  3. usage: db_load r lsn | fileid [h home] [P password] db_file 

解釋在本篇中,db_load命令幾個相關選項很參數

The T option allows nonBerkeley DB applications to easily load text files into databases.
If the database to be created is of type Btree or Hash, or the keyword keys is specified as set, the input must be paired
lines of text, where the first line of the pair is the key item, and the second line of the pair is its corresponding data
item. If the database to be created is of type Queue or Recno and the keywork keys is not set, the input must be lines of text, where each line is a new data item for the database.

選項T允許應用程序能夠將文本文件轉譯載入進數據庫。由于我們之后是將虛擬用戶的信息以文件方式存儲在文件里的,為了讓CentOS vsftpd這個
應用程序能夠通過文本來載入用戶數據,必須要使用這個選項。

If the T option is specified, the underlying access method type must be specified using the t option. 如果指定了選項T,那么一定要追跟子選項tSpecify the underlying access method. If no t option is specified, the database will be loaded into a database of the same type as was dumped; for example, a Hash database will be created if a Hash database was dumped.

Btree and Hash databases may be converted from one to the other. Queue and Recno databases may be converted from one to the other. If the k option was specified on the call to db_dump then Queue and Recno databases may be converted to Btree or Hash, with the key being the integer record number.

子選項t,追加在在T選項后,用來指定轉譯載入的數據庫類型。擴展介紹下,t可以指定的數據類型有Btree、Hash、Queue和Recon數據庫。這里,接下來我們需要指定的是Hash型。

4.察看生成的虛擬用戶數據文件

[root@KcentOS5 ~]# ll /etc/vsftpd/virtusers.db rwrr 1 root root 12288 Sep 16 03:51 /etc/vsftpd/virtusers.db
需要特別注意的是,以后再要添加虛擬用戶的時候,只需要按照“一行用戶名,一行口令”的格式將新用戶名和口令添加進虛擬用戶名單文件。但是光這樣做還不夠,不會生效的哦!還要再執行一遍“ db_load T t hash f 虛擬用戶名單文件 虛擬用戶數據庫文件.db ”的命令使
其生效才可以!

設定PAM驗證文件,并指定虛擬用戶數據庫文件進行讀取

1.察看原來的Vsftp的PAM驗證配置文件:[root@KcentOS5 ~]# cat /etc/pam.d/vsftpd

  1. #%PAM1.0  
  2. session    optional     pam_keyinit.so    force revoke  
  3. auth       required     pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed 
  4. auth       required     pam_shells.so  
  5. auth       include      systemauth  
  6. account    include      systemauth  
  7. session    include      systemauth  
  8. session    required     pam_loginuid.so 

2.在編輯前做好備份: [root@KcentOS5 ~]# cp /etc/pam.d/vsftpd /etc/pam.d/vsftpd.backup

3.編輯CentOS vsftpd的PAM驗證配置文件[root@KcentOS5 ~]# vi /etc/pam.d/vsftpd

  1. #%PAM1.0  
  2. auth    sufficient      /lib/security/pam_userdb.so     db=/etc/vsftpd/virtusers  
  3. account sufficient      /lib/security/pam_userdb.so     db=/etc/vsftpd/virtusers 


以上兩條是手動添加的,內容是對虛擬用戶的安全和帳戶權限進行驗證。這里的auth是指對用戶的用戶名口令進行驗證。這里的accout是指對用戶的帳戶有哪些權限哪些限制進行驗證。

其后的sufficient表示充分條件,也就是說,一旦在這里通過了驗證,那么也就不用經過下面剩下的驗證步驟了。相反,如果沒有通過的話,也不會被系統立即擋之門外,因為sufficient的失敗不決定整個驗證的失敗,意味著用戶還必須將經歷剩下來的驗證審核。

再后面的/lib/security/pam_userdb.so表示該條審核將調用pam_userdb.so這個庫函數進行。***的db=/etc/vsftpd/virtusers則指定了驗證庫函數將到這個指定的數據庫中調用數據進行驗證。

  1. #KC: The entries for VsftpdPAM are added above.  
  2. session    optional     pam_keyinit.so    force revoke  
  3. auth       required     pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed 
  4. auth       required     pam_shells.so  
  5. auth       include      systemauth  
  6. account    include      systemauth  
  7. session    include      systemauth  
  8. session    required     pam_loginuid.so  

CentOS vsftpd虛擬用戶的配置

1.規劃好虛擬用戶的主路徑:[root@KcentOS5 ~]# mkdir /opt/vsftp/
2.建立測試用戶的FTP用戶目錄:[root@KcentOS5 ~]# mkdir /opt/vsftp/kanecruise/ /opt/vsftp/mello/ /opt/vsftp/near/
3.建立虛擬用戶配置文件模版:[root@KcentOS5 ~]# cp /etc/vsftpd/vsftpd.conf.backup /etc/vsftpd/vconf/vconf.tmp
4.定制虛擬用戶模版配置文件:[root@KcentOS5 ~]# vi /etc/vsftpd/vconf/vconf.tmp

local_root=/opt/vsftp/virtuser指定虛擬用戶的具體主路徑。
anonymous_enable=NO設定不允許匿名用戶訪問。
write_enable=YES設定允許寫操作。
local_umask=022設定上傳文件權限掩碼。
anon_upload_enable=NO設定不允許匿名用戶上傳。
anon_mkdir_write_enable=NO設定不允許匿名用戶建立目錄。
idle_session_timeout=600設定空閑連接超時時間。
data_connection_timeout=120設定單次連續傳輸***時間。
max_clients=10設定并發客戶端訪問個數。
max_per_ip=5設定單個客戶端的***線程數,這個配置主要來照顧Flashget、迅雷等多線程下載軟件。
local_max_rate=50000設定該用戶的***傳輸速率,單位b/s。

這里將原CentOS vsftpd.conf配置文件經過簡化后保存作為虛擬用戶配置文件的模版。這里將并不需要指定太多的配置內容,主要的框架和限制交由 CentOS vsftpd的主配置文件CentOS vsftpd.conf來定義,即虛擬用戶配置文件當中沒有提到的配置項目將參考主配置文件中的設定。而在這里作為虛擬用戶的配置文件模版只需要留一些和用戶流量控制,訪問方式控制的配置項目就可以了。這里的關鍵項是local_root這個配置,用來指定這個虛擬用戶的FTP主路徑。

5.更改虛擬用戶的主目錄的屬主為虛擬宿主用戶:[root@KcentOS5 ~]# chown R overlord.overlord /opt/vsftp/
6.檢查權限:

  1. [root@KcentOS5 ~]# ll /opt/vsftp/  
  2. total 24  
  3. drwxrxrx 2 overlord overlord 4096 Sep 16 05:14 kanecruise  
  4. drwxrxrx 2 overlord overlord 4096 Sep 16 05:00 mello  
  5. drwxrxrx 2 overlord overlord 4096 Sep 16 05:00 near 

給測試用戶定制:

1.從虛擬用戶模版配置文件復制:[root@KcentOS5 ~]# cp /etc/vsftpd/vconf/vconf.tmp /etc/vsftpd/vconf/kanecruise
2.針對具體用戶進行定制:[root@KcentOS5 ~]# vi /etc/vsftpd/vconf/kanecruise

  1. local_root=/opt/vsftp/kanecruise  
  2. anonymous_enable=NO 
  3. write_enable=YES 
  4. local_umask=022 
  5. anon_upload_enable=NO 
  6. anon_mkdir_write_enable=NO 
  7. idle_session_timeout=300 
  8. data_connection_timeout=90 
  9. max_clients=1 
  10. max_per_ip=1 
  11. local_max_rate=25000 


CentOS vsftpd啟動服務:

  1. [root@KcentOS5 ~]# service vsftpd start  
  2. Starting vsftpd for vsftpd:                                [ OK ]   

【編輯推薦】

  1. CentOS vsftpd服務器安裝與編譯配置
  2. CentOS vsftpd用戶手動建立操作系統
  3. CentOS VSFTPD安裝時RPM軟件包安裝的方法
  4. centos vsftpd虛擬文件進行讀取
  5. 常用CentOS vsftpd安裝設置講解
責任編輯:佚名 來源: CSDN
相關推薦

2010-11-29 15:35:31

sybase創建用戶

2010-01-13 13:57:09

CentOS vsft

2015-01-05 09:56:41

UDPLinux TCP

2011-03-03 10:04:28

PureFTPdmysql

2011-09-06 10:17:46

2021-01-21 11:30:59

數據泄露漏洞信息安全

2011-03-25 15:21:43

2021-01-20 23:40:27

數據泄露OpenWRT攻擊

2010-10-26 16:11:18

虛擬桌面環境數據安全

2022-04-29 14:44:50

漏洞網絡攻擊網絡安全

2015-02-26 09:21:42

Jenkins數據庫加密

2010-02-22 18:27:14

CentOS vsft

2016-01-31 15:50:24

2009-08-16 22:17:23

VMware虛擬機Linux系統用戶數據

2023-10-23 19:18:05

2021-05-11 11:05:58

蘋果iOS隱私

2015-10-19 18:18:44

2022-12-01 12:14:09

2021-01-06 10:01:09

數據泄露漏洞信息安全

2019-05-17 10:10:30

優衣庫黑客數據泄漏
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 国产精成人 | 日韩福利在线 | 欧美成年人网站 | 亚洲精品日韩欧美 | 青青草免费在线视频 | 国产精品一区二区在线 | 伦理片97 | 欧美日韩在线播放 | 亚洲精品乱码久久久久久9色 | 久久亚洲国产精品日日av夜夜 | 日韩中文字幕 | 欧美成视频 | 国产精品一区二区无线 | 亚洲欧美视频一区 | 91av在线视频观看 | 日韩视频高清 | 综合久久国产 | 国产高清视频在线播放 | 国产二区在线播放 | 国产精品视频一区二区三区不卡 | 久久一区二区免费视频 | www网站在线观看 | 久久久久久久久久久久久久久久久久久久 | 香蕉视频91| 高清国产午夜精品久久久久久 | 亚洲精品成人av久久 | 国产综合在线视频 | 本道综合精品 | 一区二区三区视频在线 | 亚洲一区二区精品视频 | 女人精96xxx免费网站p | 黄网站涩免费蜜桃网站 | 一区二区手机在线 | 中文字幕精品视频 | 日日夜夜操天天干 | 日本精品视频一区二区三区四区 | 国产乱性| 久久精品99久久 | 热久久性 | 又黑又粗又长的欧美一区 | 美女视频黄的免费 |