db_load command – generate db database

The db_load utility reads either the output format used by the dump utilities or (optionally) a flat-text representation created using other tools, and stores it into a Berkeley DB database.

Syntax:

db_load [-nTV] [-c name=value] [-f file] [-h home] [-t btree | hash | queue | recno] file

The input to db_load must be in the output format specified by the db_dump utility, utilities, or as specified for the -T below. The options are as follows:

  • -t – Hash is encrypted using hash code.
  • -f – Specify a text file containing the user name and password. This file format needs to show: odd-numbered lines of user name, even-numbered lines of password.
  • -f – Read from the specified input file instead of from the standard input.
  • -c – Specify configuration options ignoring any value they may have based on the input.
  • -h – Specify a home directory for the database environment.
  • -n – Do not overwrite existing keys in the database when loading into an already existing database.
  • -V – Write the version number to the standard output and exit.

Examples of db_load Command

1. Create a new file users.txt and put the username and password in it:

# db_load -T -t hash -f /users.txt /users.db

2. Specify the database type as btree and specify the home directory of the database environment:

# db_load -T -t btree -h /root - f /users.txt /users.db

3. The database is recno and put the user name and password into vsftpd_login.db:

# db_load -T -t recno -f /etc/vsftpd/logins.txt /etc/vsftd/vsftpd_login.db

4. The db_load utility can be used to load text files into databases. For example, the following command loads the standard UNIX /etc/passwd file into a database, with the login name as the key item and the entire password entry as the data item:

$ awk -F: '{print $1; print $0}' 
Related Post