Debian 12 をクリーン・インストールしたときに実施したことメモ

はじめに

正月早々にxrdpでログインが出来なくなった。 なぜかsambaもアクセスが出来なくなり、これらを直そうとうして結局1日潰れてしまった。

1日潰しても、最終的に修復できず、とうとう再インストールする羽目になった(涙)。

これまで20年以上 Debian unstableを使ってきたが、ここいらでリリース版を中心にすることにした。 というのも、Linuxマシンはメインではないため、あまり頻繁にアップデートして最新にしておく必要性がない (アプリケーションが1-2年古くても、1-2年前の状況で困ったことは多くない)。 また、今回のようにバグを踏んで時間を使ってしまうことをなるべく避けたい。

今回の方針としては、システムは最小限のインストールにする。 機能としては、ファイルサーバー(samba), メールサーバー, httpサーバー、および最低限のデスクトップ環境とする。 デスクトップ環境はxrdpで最低限使えれば良しとしよう。

あと、なるべくsystemdを使わずに済ましたい(ネットワーク系など)。 余計なパッケージ(先端のデスクトップ環境系など)を入れると、systemd管理に変更されてしまう場合もあり、何がなんだか分からなくなってしまう。 正直Fvwmでも良いかと思っているが、設定が沼になるのでバランスをとるのも重要だ。

過去unstalbeを使ってきた背景は、Debianのリリース間隔の長さでソフト(特にEmacs系)が最新版との解離が大きくなる点だった。

一方でunstableの問題は、アプリケーションだけでなくベース・システムもunstableになる点に尽きる。 特に、基幹となるライブラリで問題があるとトラブル・シューティングに時間がかかりやすい。 昔は気力もあったが、今は他にやりたいことも多い。

ということで、EmacsやRubyなどは必要に応じてローカルでビルドする。 rbenvなどで既にそうやっているから、その範囲を少し拡大するだけのことだ。

以下はDebian 12をクリーン・インストールした場合にやったことをメモしたもの。 たまに設定などを見直すのも必要だ。

ログイン shの変更

chsh USERNAME
/usr/bin/zsh

sshdの設定変更

/etc/fstabの編集

.ssh/known_hostsの修正

これはWindows 上で行う

~$ ssh  192.168.10.105
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ED25519 key sent by the remote host is
SHA256:sB8lVltwKBGJqB3kXjr/nka8tV7bj+HCdVypGm9q3bM.
Please contact your system administrator.
Add correct host key in /home/XXXXX/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/XXXXX/.ssh/known_hosts:5
Host key for 192.168.10.105 has changed and you have requested strict checking.
Host key verification failed.
ssh-keygen -R 192.168.10.105

sudo にユーザーを追加

usermod -aG sudo XXXXX
root@zeus:/home/XXXXX# lv /etc/group | grep XXXXX
sudo:x:27:XXXXX
XXXXX:x:1000:

staff にユーザーを追加

root@zeus:/usr/local/bin# usermod -aG staff XXXXX
root@zeus:/usr/local/bin# lv /etc/group | grep XXXXX
sudo:x:27:XXXXX
staff:x:50:XXXXX
XXXXX:x:1000:

sambaユーザーの追加

root@zeus:/home/XXXXX# pdbedit -a XXXXX
new password:
retype new password:
Unix username:        XXXXX
NT username:
Account Flags:        [U          ]
User SID:             S-1-5-21-2070735123-1970338026-561827758-1000
Primary Group SID:    S-1-5-21-2070735123-1970338026-561827758-513
Full Name:            XXXXX ZZZZZ
Home Directory:       \\YYYYY\XXXXX
HomeDir Drive:
Logon Script:
Profile Path:         \\YYYYY\XXXXX\profile
Domain:               YYYYYY
Account desc:
Workstations:
Munged dial:
Logon time:           0
Logoff time:          Thu, 07 Feb 2036 00:06:39 JST
Kickoff time:         Thu, 07 Feb 2036 00:06:39 JST
Password last set:    Sat, 06 Jan 2024 12:17:59 JST
Password can change:  Sat, 06 Jan 2024 12:17:59 JST
Password must change: never
Last bad password   : 0
Bad password count  : 0
Logon hours         : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

sambaのrestart

# service smbd restart

dovecotの設定

dovecot.conf

diff -u dovecot.conf.orig dovecot.conf                                       
--- dovecot.conf.orig	20xx-xx-xx xx:xx:xx.920090652 +0900
+++ dovecot.conf	20xx-xx-xx xx:xx:xx.492091804 +0900
@@ -28,6 +28,7 @@
 # If you want to specify non-default ports or anything more complex,
 # edit conf.d/master.conf.
 #listen = *, ::
+listen = *, ::

10-auth.conf

diff -u 10-auth.conf.orig 10-auth.conf                                
--- 10-auth.conf.orig	20xx-xx-xx xx:xx:xx.664204499 +0900
+++ 10-auth.conf	20xx-xx-xx xx:xx:xx.016206440 +0900
@@ -8,9 +8,10 @@
 # connection is considered secure and plaintext authentication is allowed.
 # See also ssl=required setting.
 #disable_plaintext_auth = yes
+disable_plaintext_auth = no
 
 # Authentication cache size (e.g. 10M). 0 means it's disabled. Note that
-# bsdauth and PAM require cache_key to be set for caching to be used.
+# bsdauth, PAM and vpopmail require cache_key to be set for caching to be used.
 #auth_cache_size = 0
 # Time to live for cached data. After TTL expires the cached record is no
 # longer used, *except* if the main database lookup returns internal failure.
@@ -94,10 +95,11 @@
 #auth_ssl_username_from_cert = no
 
 # Space separated list of wanted authentication mechanisms:
-#   plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi otp
+#   plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi otp skey
 #   gss-spnego
 # NOTE: See also disable_plaintext_auth setting.
-auth_mechanisms = plain
+#auth_mechanisms = plain
+auth_mechanisms = plain login
 
 ##
 ## Password and user databases
@@ -124,4 +126,5 @@
 #!include auth-ldap.conf.ext
 #!include auth-passwdfile.conf.ext
 #!include auth-checkpassword.conf.ext
+#!include auth-vpopmail.conf.ext
 #!include auth-static.conf.ext

10-mail.conf

diff -u 10-mail.conf.orig 10-mail.conf                               
--- 10-mail.conf.orig	20xx-xx-xx xx:xx:xx.700123965 +0900
+++ 10-mail.conf	20xx-xx-xx xx:xx:xx.960124994 +0900
@@ -27,7 +27,8 @@
 #
 # 
 #
-mail_location = mbox:~/mail:INBOX=/var/mail/%u
+#mail_location = mbox:~/mail:INBOX=/var/mail/%u
+mail_location = maildir:~/Maildir
 
 # If you need to set multiple mailbox locations or want to change default
 # namespace settings, you can do it by defining namespace sections.
@@ -50,7 +51,7 @@
 
   # Prefix required to access this namespace. This needs to be different for
   # all namespaces. For example "Public/".
-  #prefix = 
+  prefix = INBOX.
 
   # Physical location of the mailbox. This is in same format as
   # mail_location, which is also the default for it.
@@ -412,8 +413,7 @@
 # Settings to control adding $HasAttachment or $HasNoAttachment keywords.
 # By default, all MIME parts with Content-Disposition=attachment, or inlines
 # with filename parameter are consired attachments.
-#   add-flags - Add the keywords when saving new mails or when fetching can
-#      do it efficiently.
+#   add-flags-on-save - Add the keywords when saving new mails.
 #   content-type=type or !type - Include/exclude content type. Excluding will
 #     never consider the matched MIME part as attachment. Including will only
 #     negate an exclusion (e.g. content-type=!foo/* content-type=foo/bar).

10-ssl.conf

-- 10-ssl.conf.orig    2025-03-22 17:33:37.512203690 +0900
+++ 10-ssl.conf 2025-03-22 17:34:29.016206440 +0900
@@ -3,7 +3,8 @@
 ##
 
 # SSL/TLS support: yes, no, required. 
-ssl = yes
+#ssl = yes
+ssl = no

apacheの設定

とくに何をせずに済んだ。