問題
SMB サービスを開始できません。SAMBA 共有にアクセスできません。 systemctl を使用してもサービスの開始に失敗し、以下は smb サービスのステータスです。
# systemctl status smb.service ? smb.service - Samba SMB Daemon Loaded: loaded (/usr/lib/systemd/system/smb.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Fri 2017-07-07 10:07:54 AEST; 3 days ago Process: 25847 ExecStart=/usr/sbin/smbd $SMBDOPTIONS (code=exited, status=1/FAILURE) Main PID: 25847 (code=exited, status=1/FAILURE) The following entries are logged to the /var/log/messages file: Jul 07 10:07:54 localhost smbd[25847]: Unable to open new log file '/var/log/sa...ed Jul 07 10:07:54 localhost smbd[25847]: [2017/07/07 10:07:54, 0] ../lib/util/de...l) Jul 07 10:07:54 localhost smbd[25847]: Unable to open new log file '/var/log/sa...ed Jul 07 10:07:54 localhost smbd[25847]: [2017/07/07 10:07:54, 0] ../source3/smb...n) Jul 07 10:07:54 localhost smbd[25847]: smbd version 4.2.3 started. Jul 07 10:07:54 localhost smbd[25847]: Copyright Andrew Tridgell and the Samba ...14 Jul 07 10:07:54 localhost systemd[1]: smb.service: main process exited, code=ex...RE Jul 07 10:07:54 localhost systemd[1]: Failed to start Samba SMB Daemon. Jul 07 10:07:54 localhost systemd[1]: Unit smb.service entered failed state. Jul 07 10:07:54 localhost systemd[1]: smb.service failed.
解決策
<強い>1. SELinux を無効にする
RHEL 7 のほとんどの場合、SELinux が有効 (強制) の場合、samba サービスは開始されません。 SELinux を無効にするか、推奨のみにします。 setenforce コマンドは、強制モードと許可モードを切り替えるために使用されます。許可モードに変更するには:
# setenforce 0
getenforce コマンドを使用して、現在の SELinux モードを表示します:
# getenforce PermissiveRHEL/CentOS で SELinux モードを有効/無効にする方法
<強い>2. SAMBA サービスを許可するように SELinux を構成する
SELinux を無効にしたくない場合は、SAMBA サブシステムの実行を許可する SELinux ポリシーを確認できます。現在の SELinux ポリシーを確認するには、以下のコマンドを使用してください。
# getsebool -a | grep samba # getsebool -a | grep nmb
これにより、オプションのリストと、これらがオンかオフかが表示されます。それらはオンになっている必要があります。設定は、以下のコマンドを使用して変更できます。
構文:
# setsebool -P [boolean] on
例:
# setsebool -P bacula_use_samba on