Hi, all!
I create a Berkeley DB file for Vsftpd, I want user Ruby add new Vsftpd
virtual users via edit the Berkeley DB file.
I create BDB file as follow:
bash> $ cat > test.txt << EOF
bar
Hello,
foo
World!
EOF
bash> $ db48_load -T -t hash -f ./test.txt ./test.db
bash> $ file test.db
test.db: Berkeley DB (Hash, version 9, native byte-order)
bash> $ db48_dump -p test.db
VERSION=3
format=print
type=hash
h_nelem=2
db_pagesize=4096
HEADER=END
foo
World!
bar
Hello,
DATA=END
bash> $ irb
2.0.0-p353 :001 > Dir.entries(Dir.pwd())
=> [".", “…”, “test.txt”, “test.db”]
2.0.0-p353 :002 > require ‘dbm’
=> true
2.0.0-p353 :003 > DBM.open("./test.db") do |db|
2.0.0-p353 :004 > db.each_pair {|key, value| print “#{key}:
#{value}\n”}
2.0.0-p353 :005?> end
=> #DBM:0x00000002185590
2.0.0-p353 :006 > Dir.entries(Dir.pwd())
=> [".", “…”, “test.txt”, “test.db”, “test.db.pag”, “test.db.dir”]
2.0.0-p353 :007 >
bash> $ file test.db.dir
test.db.dir: GNU dbm 2.x database
I do not understand, why DBM cannot read Berkeley DB file, but can
create a
GNU dmb file?
Thanks & Regards