コンテンツにスキップ

Ubuntu で tshark を対話せずにインストールする

Ubuntu で tshark をインストールする際、Should non-superusers be able to capture packets? のようなメッセージが表示され、Yes or No の対話的入力を求められる場合があります。 これでは「スクリプト中で tshark をインストールしたい」という場合、入力が要求されてスクリプトが止まってしまい不便です。 今回はこの対話的入力無しに tshark をインストールする方法をメモしておきます。

検証環境

対象 バージョン
Ubuntu 24.04.2 LTS

対話的入力を要求されるインストール

Ubuntu で tshark をインストールする場合、以下のように実行します。

apt -y install tshark

ですが、以下のように対話的な入力を求められてしまいました。

  ┌───────────────────────────────────┤ Configuring wireshark-common ├───────────────────────────────────┐
                                                                                                           Dumpcap can be installed in a way that allows members of the "wireshark" system group to capture        packets. This is recommended over the alternative of running Wireshark/Tshark directly as root,         because less of the code will run with elevated privileges.                                                                                                                                                     For more detailed information please see /usr/share/doc/wireshark-common/README.Debian.gz once the      package is installed.                                                                                                                                                                                           Enabling this feature may be a security risk, so it is disabled by default. If in doubt, it is          suggested to leave it disabled.                                                                                                                                                                                 Should non-superusers be able to capture packets?                                                                                                                                                                                           <Yes>                                <No>                                                                                                                                          └──────────────────────────────────────────────────────────────────────────────────────────────────────┘

対話的入力が不要なインストール

対話的入力を必要とせず、インストールを行うには以下のように実行します。

DEBIAN_FRONTEND=noninteractive apt -y install tshark