smbサーバーの共有ディレクトリをzenityで選択してgioでマウントする

Linux Mint 21 Vanessa
zenity 3.42.1
libglib2.0-bin 2.72.1

スクリプトを作成する。

#!/bin/bash
directory=$(zenity --list \
    --title="共有ディレクトリ" \
    --text="アクセスするディレクトリを選択してください。" \
    --width=400 --height=600 \
    --print-column=1 \
    --column="ディレクトリ名" \
        "共有1" \
        "共有2" \
        "共有3" \
2>/dev/null)
if [ $? -eq 1 ]; then
    exit 0;
fi
if [ ! -d "/run/user/$UID/gvfs/smb-share:server=samba-server.local,share=$directory/" ]; then
    echo -e "user\nWORKGROUP\nPassword\n" | gio mount smb://samba-server.local/$directory 1>/dev/null 2>/dev/null
fi
xdg-open smb://samba-server.local/$directory/

スクリプトを実行可能にする。

$ chmod +x ~/bin/gio-mount.sh

ディスプレイなしのXubuntu22.04にVNCでアクセスする

Xubuntu 22.04 TLS
TigerVNC Server 1.12.0
xserver-xorg-video-dummy 0.3.8

ここの手順でVNCサーバーとして設定されている前提です。この設定を行わない場合でもVNCビューワーで接続してもっさり操作は可能です。

必要なパッケージをインストールする。

apt install xserver-xorg-video-dummy

Xorgの設定ファイルにダミーディスプレイドライバを使用する設定を書き込む。内容はArchWikiのコピペっす。

Section "Monitor"
        Identifier "dummy_monitor"
        HorizSync 28.0-80.0
        VertRefresh 48.0-75.0
        Modeline "1920x1080" 172.80 1920 2040 2248 2576 1080 1081 1084 1118
EndSection

Section "Device"
        Identifier "dummy_card"
        VideoRam 256000
        Driver "dummy"
EndSection

Section "Screen"
        Identifier "dummy_screen"
        Device "dummy_card"
        Monitor "dummy_monitor"
        SubSection "Display"
        EndSubSection
EndSection

Xubuntu22.04でVNCサーバーを起動して画面共有する

Xubuntu 22.04 TLS
TigerVNC Server 1.12.0

Xubuntuに必要なパッケージをインストールする。

# apt install tigervnc-scraping-server

vncのパスワードファイルを作成する。

$ tigervncpasswd

Xubuntuにログインした状態でvncサーバーを起動する。
※-localhostオプションはデフォルトでyesなので明示的にnoを指定する

$ x0tigervncserver -localhost=no

Xubuntu22.04でVNCサーバーを起動してsshトンネル経由で画面共有する

Xubuntu 22.04 TLS
TigerVNC Server 1.12.0
OpenSSH 8.9

Xubuntuに必要なパッケージをインストールする。

# apt install ssh tigervnc-scraping-server

sshサーバーを有効化して開始する。

# systemctl enable --now ssh

Xubuntuにログインした状態でvncサーバーを起動する。

$ x0tigervncserver -localhost=yes -securitytypes=none

外部から接続するには下記のコマンドをリモート側で実行しsshポートフォワーディングを開始する。
※-Lオプションはリモート側のlocalhost:12345をホスト側のlocalhost:5900に転送するという意味らしい

$ ssh user@hostname.local.example.com -L 12345:localhost:5900

sshを接続したままの状態でvncビューワーでlocalhost:12345に接続する。

$ xtigervncviewer localhost:12345

smbサーバーの共有ディレクトリをwhiptailで選択してgioでマウントする

Linux Mint 20.3 (Una)
whiptail 0.52.21
libglib2.0-bin 2.64.6

スクリプトを作成する。

#!/bin/bash
directories=("共有1" "共有2" "共有3")
radioList=()
listIndex=0
for index in "${!directories[@]}"
do
    radioList[${listIndex}]=$index
    radioList[${listIndex}+1]=${directories[${index}]}
    radioList[${listIndex}+2]=OFF
    listIndex+=3
done
selectedIndex=$(whiptail --title "共有ディレクトリ" --radiolist "アクセスするディレクトリを選択してください。" 20 80 15 "${radioList[@]}" --notags 3>&1 1>&2 2>&3)
if [ ${#selectedIndex} == 0 ]; then
    exit 0
fi
directory=${directories[${selectedIndex}]}
if [ ! -d /run/user/$UID/gvfs/smb-share:server=samba-server,share=$directory/ ]; then
    echo -e "user\nWORKGROUP\nPassword\n" | gio mount smb://samba-server/$directory 1>/dev/null 2>/dev/null
fi
xdg-open smb://samba-server/$directory/

スクリプトを実行可能にする。

$ chmod +x ~/bin/gio-mount.sh

AlmaLinux8のPostfixでEメールをDKIMで送信する

この記事で設定したPostfixを使用する。

AlmaLinux release 8.5 (Arctic Sphynx)
postfix 3.5.8
opendkim 2.11.0

EPELリポジトリを追加する。

# dnf install epel-release

必要なパッケージをインストールする。

# dnf install opendkim
# dnf install opendkim-tools

鍵を格納するディレクトリを作成する。

# cd /etc/opendkim/keys/
# mkdir hirohiro716.com alias.hirohiro716.com
# chmod 750 *

鍵を作成する。–selectorオプションは1つのドメインに複数の鍵を設定する場合を除き指定する必要はない。

# opendkim-genkey -D /etc/opendkim/keys/hirohiro716.com/ -d hirohiro716.com
# opendkim-genkey -D /etc/opendkim/keys/alias.hirohiro716.com/ -d alias.hirohiro716.com
# chown -R opendkim:opendkim /etc/opendkim/keys/

作成されたdefault.txtを参考にDNSレコードを登録しておく。

default._domainkey.hirohiro716.com TXT 0 v=DKIM1; k=rsa; p=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
_adsp._domainkey.hirohiro716.com TXT 0 dkim=unknown
default._domainkey.alias.hirohiro716.com TXT 0 v=DKIM1; k=rsa; p=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
_adsp._domainkey.alias.hirohiro716.com TXT 0 dkim=unknown

opendkimの設定を変更する。
※変更箇所のみ記載

Mode  sv
SoftwareHeader  no
KeyTable  /etc/opendkim/KeyTable
SigningTable  refile:/etc/opendkim/SigningTable

KeyTableを変更して使用する秘密鍵を指定する。

default._domainkey.hirohiro716.com hirohiro716.com:default:/etc/opendkim/keys/hirohiro716.com/default.private
default._domainkey.alias.hirohiro716.com alias.hirohiro716.com:default:/etc/opendkim/keys/alias.hirohiro716.com/default.private

SigningTableを変更して署名するドメインを指定する。

*@hirohiro716.com default._domainkey.hirohiro716.com
*@alias.hirohiro716.com default._domainkey.alias.hirohiro716.com

サービスを有効化して実行する。

# systemctl enable --now opendkim

Postfixの設定ファイルの最下部に下記を追記する。

# DKIM settings.
smtpd_milters = inet:127.0.0.1:8891
non_smtpd_milters = $smtpd_milters
milter_default_action = accept

Postfixの設定を再読み込みする。

# systemctl reload postfix