db_load命令用法

来源:互联网 发布:葡萄牙 法国 知乎 编辑:程序博客网 时间:2024/06/08 17:02

[root@localhost RPMS]# rpm -ivh db4-utils-4.2.52-7.1.i386.rpm
warning: db4-utils-4.2.52-7.1.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing…                ########################################### [100%]
   1:db4-utils              ########################################### [100%]
[root@localhost RPMS]# db_
db_archive     db_deadlock    db_dump185     db_printlog    db_stat        db_verify
db_checkpoint  db_dump        db_load        db_recover     db_upgrade
[root@localhost RPMS]# db_load
usage: db_load [-nTV] [-c name=value] [-f file]
        [-h home] [-P password] [-t btree | hash | recno | queue] db_file

db_load命令需要安装 db4-utils这个软件包,在RHEL4.5中,这个软件包在第三个VCD光盘中.
db_load命令几个相关选项:
-T
The -T option allows non-Berkeley 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允许应用程序能够将文本文件转译载入进数据库。由于我们之后是将虚拟用户的信息以文件方式存储在文件里的,为了让Vsftpd这个应用程序能够通过文本来载入用户数据,必须要使用这个选项。
If the -T option is specified, the underlying access method type must be specified using the -t option.
如果指定了选项-T,那么一定要追跟子选项-t

-t
Specify 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数据库。

-f
参数后面接包含用户名和密码的文本文件,文件的内容是:奇数行用户名、偶数行密码,例如:
yonghu1
mima1234
yonghu2
mima1234

将用户信息文件转换为数据库并使用hash加密
db_load -T -t hash -f /etc/vsftpd/logins.txt /etc/vsftd/vsftpd_login.db


0 0