log level = 1 #通常運用時のレベルは0か1。運用開始時は2か3。4以上は開発者向け。レベルを上げすぎると情報が大量に出力される。最大でも3レベルで留めるのを推奨。
例)log level = 3 でログを出力した場合
# tail -f /var/log/samba/log.smbd
[2024/10/30 20:11:51.298702, 2] ../../source3/passdb/pdb_interface.c:163(make_pdb_method_name)
No builtin backend found, trying to load plugin
[2024/10/30 20:11:51.299350, 3] ../../lib/util/modules.c:167(load_module_absolute_path)
load_module_absolute_path: Module '/usr/lib64/samba/pdb/tdbsam.so' loaded
[2024/10/30 20:11:51.307005, 3] ../../source3/lib/util_procid.c:53(pid_to_procid)
例)ログレベルを一時的にレベル1に変更する方法
【書式】smbcontrol プロセス debug ログレベル
# smbcontrol smbd debug 1
# cat /var/log/samba/log.smbd
[2024/10/30 20:17:22.025400, 3] ../../lib/util/debug_s3.c:97(debug_message)
INFO: Remote set of debug to `1' (pid 2728 from pid 2734)
[2024/10/30 20:17:22.025510, 3] ../../lib/util/debug_s3.c:97(debug_message)
INFO: Remote set of debug to `1' (pid 2731 from pid 2728)
[2024/10/30 20:17:22.025641, 3] ../../lib/util/debug_s3.c:97(debug_message)
INFO: Remote set of debug to `1' (pid 2730 from pid 2728)
◆Sambaの動作状況の確認
# smbstatus
Samba version 4.19.4
PID Username Group Machine Protocol Version Encryption Signing
----------------------------------------------------------------------------------------------------------------------------------------
2868 nobody nobody 10.0.1.1 (ipv4:10.0.1.1:51782) SMB3_11 - -
Service pid Machine Connected at Encryption Signing
---------------------------------------------------------------------------------------------
tmp 2868 10.0.1.1 月 10月 7 02時37分13秒 2024 JST - -
Locked files:
Pid User(ID) DenyMode Access R/W Oplock SharePath Name Time
--------------------------------------------------------------------------------------------------
2868 65534 DENY_NONE 0x100081 RDONLY NONE /tmp . Mon Oct 7 02:37:15 2024
2868 65534 DENY_NONE 0x100081 RDONLY NONE /tmp . Mon Oct 7 02:37:15 2024
2868 65534 DENY_NONE 0x100081 RDONLY NONE /tmp . Mon Oct 7 02:37:15 2024
smbstatusコマンドの情報は上から大きく
・コネクションの一覧
・各セッションが開いている共有の一覧
・ロックされているファイルの一覧
◆TDBファイル操作
TDBはSamba独自のデータベース形式です。TDBファイルはバイナリ形式なので、操作に専用のコマンドが必要になります。
□tdbbackup
TDBファイルのバックアップと破損の検出を行います。
【書式】tdbbackup [-v] TDBファイル名
-vオプションを指定した場合、TDBファイルの内容を検査し、破損を検出した場合はリストアを行います。
次のコマンドを実行すると、secrets.tdbファイルのバックアップをsecrets.tdb.bakというファイル名で作成します。
□tdpdump
引数に指定した任意のTDBファイルの内容を画面に表示します。
【書式】tdbdump TDBファイル名
# tdbbackup secrets.tdb
□tdbrestore
TDBファイルのリストアを行います。
【書式】tdbrestore TDBファイル名 < tdbdumpコマンドの出力ファイル
□tdbtool
このコマンドを使って、TDBデータベースを直接メンテナンス出来ます。以下はtdbtoolコマンドを起動してヘルプを表示させた例です。
# tdbtool
tdb> ?
database not open
tdbtool:
create dbname : create a database
open dbname : open an existing database
transaction_start : start a transaction
transaction_commit : commit a transaction
transaction_cancel : cancel a transaction
erase : erase the database
dump : dump the database as strings
keys : dump the database keys as strings
hexkeys : dump the database keys as hex values
info : print summary info about the database
insert key data : insert a record
move key file : move a record to a destination tdb
storehex key data : store a record (replace), key/value in hex format
store key data : store a record (replace)
show key : show a record by key
delete key : delete a record by key
list : print the database hash table and freelist
free : print the database freelist
freelist_size : print the number of records in the freelist
check : check the integrity of an opened database
repack : repack the database
speed : perform speed tests on the database
! command : execute system command
1 | first : print the first record
n | next : print the next record
q | quit : terminate
\n : repeat 'next' command
tdb>
例題
問題集 51~54頁問5,6,7,8,10,12~15
Sambaの保守 - Linux技術者認定 LinuC | LPI-Japan
Sambaのトラブルシューティング - Linux技術者認定 LinuC | LPI-Japan
国際化 - Linux技術者認定 LinuC | LPI-Japan
Sambaの保守 - Linux技術者認定 LinuC | LPI-Japan
Sambaを設定する - Linux技術者認定 LinuC | LPI-Japan
Sambaの保守 - Linux技術者認定 LinuC | LPI-Japan
Sambaを設定する - Linux技術者認定 LinuC | LPI-Japan