Samba - AlmaLinux

Sambaのインストール

sudo dnf -y install samba

設定ファイルのパスは、「 /etc/samba/smb.conf 」です。

sudo vi /etc/samba/smb.conf

/etc/samba/smb.conf 初期内容

# See smb.conf.example for a more detailed config file or
# read the smb.conf manpage.
# Run 'testparm' to verify the config is correct after
# you modified it.
#
# Note:
# SMB1 is disabled by default. This means clients without support for SMB2 or
# SMB3 are no longer able to connect to smbd (by default).

[global]
        workgroup = SAMBA // 環境に合わせてワークグループ名を変更
        security = user

        passdb backend = tdbsam

        printing = cups
        printcap name = cups
        load printers = yes
        cups options = raw

[homes]
        comment = Home Directories
        valid users = %S, %D%w%S
        browseable = No
        read only = No
        inherit acls = Yes

[printers]
        comment = All Printers
        path = /var/tmp
        printable = Yes
        create mask = 0600
        browseable = No

[print$]
        comment = Printer Drivers
        path = /var/lib/samba/drivers
        write list = @printadmin root
        force group = @printadmin
        create mask = 0664
        directory mask = 0775

Samba 用のユーザーを登録する

sudo smbpasswd -a user

サービスの起動

sudo systemctl start smb
sudo systemctl start nmb

# 自動起動の設定
sudo systemctl enable smb
sudo systemctl enable nmb

ファイアウォールとSELinuxの設定

sudo firewall-cmd --permanent --add-service=samba --zone=public
sudo firewall-cmd --reload

# SELinuxの設定変更
sudo setsebool -P samba_enable_home_dirs on

WindowsからSambaサーバーにアクセスする

エクスプローラを起動して画面の「 ネットワーク 」をクリックします。

ホストが表示されない場合は、マスタブラウザに情報が登録されていない為です。アドレスバーにサーバーのIPアドレスを入力して表示されるか確認します。

サーバーのIPアドレスが、192.168.11.9 の場合、「 ¥¥192.168.11.9 」とアドレスバーに入力します。