構成
共有フォルダは下記の構成にする。
| 共有名 | ディレクトリ | 説明 |
|---|---|---|
| www | /home/www-data | Windowsユーザ「user1」のみ読み書き可能。 Linux上ではLinuxユーザ「www-data」の所有物とする。 |
| share | /home/share | 誰でも読み書き可能。 Linux上ではLinuxユーザ「root」ユーザの所有物とする。 |
設定手順
インストール
Sambaのインストールと設定ファイルのバックアップ。
apt-get install samba cd /etc/samba cp smb.conf smb.conf.old
フォルダ作成
mkdir /home/share
Sambaユーザ作成
ユーザ「user1」を作成する。パスワードを聞かれるので「user1」のパスワードを入力する。
smbpasswd -a user1
ちなみにパスワードを変更する際は次のコマンドを入力する。
smbpasswd -x user1
設定ファイルの編集
/etc/samba/smb.confファイルを編集する。
#======================= Global Settings ======================= [global] workgroup = WORKGROUP server string = %h server dns proxy = no interfaces = 192.168.0.0/24 eth0 bind interfaces only = yes log file = /var/log/samba/log.%m max log size = 1000 syslog = 0 panic action = /usr/share/samba/panic-action %d encrypt passwords = true server role = standalone server passdb backend = tdbsam obey pam restrictions = yes unix password sync = no passwd program = /usr/bin/passwd %u passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . pam password change = yes map to guest = never usershare allow guests = yes #======================= Share Definitions ======================= # Website Directory [www] comment = Website Files path = /home/www-data valid users = user1 force user = www-data read only = No create mask = 0700 seciruty mask = 0700 # Share Directory [share] comment = Share Files path = /home/share guest ok = yes force user = root read only = no create mask = 0755 security mask = 0755