操作
VPSを借りて、postfixを使用したメールサーバーを構築しました。
その後、メールユーザーを設置するため、nologinユーザーを作成しました。
COMMAND
1[root@******** ********]# useradd -s /bin/nologin testuser 2[root@******** ********]# echo 'r2L******3G' | saslpasswd2 -p -u mail.**********.jp -c testuser
結果
しかし、/etc/shadowにハッシュ値が設定されていません。
COMMAND
1[root@******** ********]# cat /etc/passwd | grep testuser 2testuser:x:1010:1010::/home/testuser:/bin/nologin 3 4[root@******** ********]# cat /etc/shadow | grep testuser 5testuser:!!:19127:0:99999:7:::
質問
上記でわかるように/etc/shadowの第2項が'!!'となり、ハッシュ値が記録されないのはなぜでしょうか。
その他
他のユーザーの場合、第2項は埋まっています。
testuser1:$6$r7sCym2******************************************************Mdo9:19110:0:99999:7:::
またsaslのユーザーとしても認識されています。
COMMAND
1[root@******** ********]# sasldblistusers2 2testuser@mail.**********.jp: userPassword
なお、passwdにて設定すると当然ですがハッシュ値が記録されます。
COMMAND
1[root@******** ********]# passwd testuser 2ユーザー testuser のパスワードを変更。 3新しいパスワード: 4新しいパスワードを再入力してください: 5passwd: すべての認証トークンが正しく更新できました。 6[root@******** ********]# cat /etc/passwd | grep testuser 7testuser:x:1010:1010::/home/testuser:/bin/nologin 8[root@******** ********]# cat /etc/shadow | grep testuser 9testuser:$6$8a653o*****************************************************dOz97hO0:19127:0:99999:7::: 10[root@******** ********]#
OS等の環境・バージョン等
VPS標準のOSを使用しています。
[root@******** ********]# systemctl status saslauthd ● saslauthd.service - SASL authentication daemon. Loaded: loaded (/usr/lib/systemd/system/saslauthd.service; enabled; vendor preset: disabled) (以下略)
OSのバージョンは次の通りです。
# uname -a Linux ***************.jp 3.10.0-1160.62.1.el7.x86_64 #1 SMP Tue Apr 5 16:57:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux [root@******** ********]#
cyrus-saslはインストールされていません。この状態でもtestuser以外では正常にメールの送受信ができるユーザーを設定できています。
# rpm -qa | grep cyrus #
その他の設定は、以下の通りです。
# cat /etc/sasl2/smtpd.conf (コメントを除く) pwcheck_method: auxprop mech_list: cram-md5 plain login # cat /etc/sysconfig/saslauthd (コメントを除く) MECH=pam # cat /etc/postfix/main.cf | grep smtpd_sasl_auth_enable smtpd_sasl_auth_enable = yes #
CentOS ではなく Red Hat Enterprise のドキュメントですが、以下の様に記載されています。
Chapter 4. Managing Users and Groups Red Hat Enterprise Linux 7
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-managing_users_and_groups#s2-users-tools-users-add
> Two exclamation marks (!!) appear in the password field of the /etc/shadow file, which locks the account.
アカウントのロックまたはファイルのロックのいずれかは知識不足で分かりませんが、ロックによりパスワードフィールドへの設定がされなかった可能性があるのですね。
操作の状態を確認してみたいと思います。また、ドキュメントも読んでみたいと思います。
ありがとうございました。
回答2件
あなたの回答
tips
プレビュー