自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

CentOS vsftpd制作虛擬用戶數(shù)據(jù)庫文件

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

制作虛擬用戶數(shù)據(jù)庫文件

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

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

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

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

3.生成虛擬用戶數(shù)據(jù)文件:

[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命令幾個相關(guān)選項很參數(shù)

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允許應用程序能夠?qū)⑽谋疚募D(zhuǎn)譯載入進數(shù)據(jù)庫。由于我們之后是將虛擬用戶的信息以文件方式存儲在文件里的,為了讓CentOS vsftpd這個
應用程序能夠通過文本來載入用戶數(shù)據(jù),必須要使用這個選項。

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選項后,用來指定轉(zhuǎn)譯載入的數(shù)據(jù)庫類型。擴展介紹下,t可以指定的數(shù)據(jù)類型有Btree、Hash、Queue和Recon數(shù)據(jù)庫。這里,接下來我們需要指定的是Hash型。

4.察看生成的虛擬用戶數(shù)據(jù)文件

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

設(shè)定PAM驗證文件,并指定虛擬用戶數(shù)據(jù)庫文件進行讀取

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 


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

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

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

  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.規(guī)劃好虛擬用戶的主路徑:[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設(shè)定不允許匿名用戶訪問。
write_enable=YES設(shè)定允許寫操作。
local_umask=022設(shè)定上傳文件權(quán)限掩碼。
anon_upload_enable=NO設(shè)定不允許匿名用戶上傳。
anon_mkdir_write_enable=NO設(shè)定不允許匿名用戶建立目錄。
idle_session_timeout=600設(shè)定空閑連接超時時間。
data_connection_timeout=120設(shè)定單次連續(xù)傳輸***時間。
max_clients=10設(shè)定并發(fā)客戶端訪問個數(shù)。
max_per_ip=5設(shè)定單個客戶端的***線程數(shù),這個配置主要來照顧Flashget、迅雷等多線程下載軟件。
local_max_rate=50000設(shè)定該用戶的***傳輸速率,單位b/s。

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

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

  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用戶手動建立操作系統(tǒng)
  3. CentOS VSFTPD安裝時RPM軟件包安裝的方法
  4. centos vsftpd虛擬文件進行讀取
  5. 常用CentOS vsftpd安裝設(shè)置講解
責任編輯:佚名 來源: CSDN
相關(guān)推薦

2010-01-13 13:57:09

CentOS vsft

2010-11-29 15:35:31

sybase創(chuàng)建用戶

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

數(shù)據(jù)泄露漏洞信息安全

2021-01-20 23:40:27

數(shù)據(jù)泄露OpenWRT攻擊

2010-02-22 18:27:14

CentOS vsft

2010-10-26 16:11:18

虛擬桌面環(huán)境數(shù)據(jù)安全

2022-04-29 14:44:50

漏洞網(wǎng)絡(luò)攻擊網(wǎng)絡(luò)安全

2011-03-25 15:21:43

2009-08-16 22:17:23

VMware虛擬機Linux系統(tǒng)用戶數(shù)據(jù)

2015-02-26 09:21:42

Jenkins數(shù)據(jù)庫加密

2021-01-06 10:01:09

數(shù)據(jù)泄露漏洞信息安全

2016-01-31 15:50:24

2022-12-01 12:14:09

2021-05-11 11:05:58

蘋果iOS隱私

2023-10-23 19:18:05

2015-10-19 18:18:44

2017-05-23 14:56:49

MySQLvsftpd虛擬用戶
點贊
收藏

51CTO技術(shù)棧公眾號