LoginSignup
4
7

More than 5 years have passed since last update.

Linux上にCIFS共有を公開してWindowsから参照するまでの手順

Last updated at Posted at 2016-02-27

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-dcsambaとは別のサービスであることに注意。

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' に接続します:
コマンドは正常に終了しました。
4
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
7