Linux上にCIFS共有を公開し、LAN内のWindows機器から参照(マウント)するまでの手順。
※セキュリティ設定等は別途必要
実施環境
項目 | 値 |
---|---|
OS | Ubuntu 16.04 |
sambaバージョン | 4.3.11+dfsg-0ubuntu0.16.04.13 |
インストール
sambaパッケージをインストールする。
$ sudo aptitude install samba
sambaの状態確認
$ sudo systemctl status samba-ad-dc
● samba-ad-dc.service - LSB: start Samba daemons for the AD DC
Loaded: loaded (/etc/init.d/samba-ad-dc)
Active: active (exited)
※samba-ad-dc
はsamba
とは別のサービスであることに注意。
samba設定
設定ファイル
/etc/samba/smb.conf
に以下を追記する
smb.conf設定
[homes]
comment = Home directory
path = /home/hoge/
browseable = yes
public = yes
read only = no
writable = yes
sambaユーザ追加
$ sudo pdbedit --create <user-name>
new password:
retype new password:
<成功すると色々情報が出力される>
sambaグループ作成
$ sudo groupadd smbgroup
$
sambaグループにユーザ追加
$ sudo gpasswd --add <user-name> smbgroup
ユーザ <user-name> をグループ smbgroup に追加
$
所有者設定
公開するディレクトリの所有者をsambaユーザ・グループにする。
$ sudo chown -R <user-name>.smbgroup /home/hoge/
samba再起動
$ sudo systemctl restart samba-ad-dc
WindowsからCIFS共有に接続
Windowsのコンソールから、Linux上のCIFS共有に接続する例。
>net use k: \\192.168.xxx.xxx\homes /user:<user-name>
'<user-name>' のパスワードを入力してください。'192.168.xxx.xxx' に接続します:
コマンドは正常に終了しました。