ユーザ用ツール

サイト用ツール


openwrt:install-samba

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
openwrt:install-samba [2013/03/23 14:46] – [設定] adminopenwrt:install-samba [2013/11/21 15:04] (現在) – [起動] admin
行 1: 行 1:
 ====== Samba のインストール ====== ====== Samba のインストール ======
  
-  * OpenWrt: ATTITUDE ADJUSTMENT (12.09-rc1r34185)+  * OpenWrt: ATTITUDE ADJUSTMENT (12.09, r36088)
  
  
  
   - [[http://wiki.openwrt.org/doc/howto/cifs.server|Samba]]   - [[http://wiki.openwrt.org/doc/howto/cifs.server|Samba]]
- 
  
 ===== パッケージをインストール ===== ===== パッケージをインストール =====
行 16: 行 15:
 # opkg update # opkg update
 # opkg list | grep samba # opkg list | grep samba
-luci-app-samba - 0.11+svn9425-1 - Network Shares - Samba SMB/CIFS module +luci-app-samba - 0.11.1-1 - Network Shares - Samba SMB/CIFS module 
-samba36-client - 3.6.5-- Samba 3.6 SMB/CIFS client +samba36-client - 3.6.5-- Samba 3.6 SMB/CIFS client 
-samba36-server - 3.6.5-- The Samba software suite is a collection of programs that implements the+samba36-server - 3.6.5-- The Samba software suite is a collection of programs that implements the SMB protocol for UNIX systems, allowing you to serve files and printers to Windows, NT, OS/2 and DOS clients. This protocol is sometimes also referred to as the LanManager or Netbios protocol.
 </code> </code>
  
行 25: 行 24:
 <code> <code>
 # opkg install samba36-server luci-app-samba # opkg install samba36-server luci-app-samba
-Installing samba36-server (3.6.5-2) to root... +Installing samba36-server (3.6.5-3) to root... 
-Downloading http://downloads.openwrt.org/attitude_adjustment/12.09-rc1/ar71xx/generic/packages/samba36-server_3.6.5-2_ar71xx.ipk. +Downloading http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/samba36-server_3.6.5-3_ar71xx.ipk. 
-Installing luci-app-samba (0.11+svn9425-1) to root... +Installing luci-app-samba (0.11.1-1) to root... 
-Downloading http://downloads.openwrt.org/attitude_adjustment/12.09-rc1/ar71xx/generic/packages/luci-app-samba_0.11+svn9425-1_ar71xx.ipk.+Downloading http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/luci-app-samba_0.11.1-1_ar71xx.ipk.
 Configuring samba36-server. Configuring samba36-server.
 Configuring luci-app-samba. Configuring luci-app-samba.
 </code> </code>
 +
 +Samba を起動時に自動起動するように設定。
 +
 +<code>
 +# /etc/init.d/samba enable
 +</code>
 +
 +Samba を起動。
 +
 +<code>
 +# /etc/init.d/samba start
 +</code>
 +
 +
 +===== アクセスするユーザの追加 =====
 +
 +ユーザ単位のアクセス制限をする。まずは、 Samba に接続するユーザを作成する。
 +
 +
 +<code>
 +# vi /etc/passwd
 +</code>
 +
 +以下の行を追加してユーザを新規作成する。(username は作成するユーザ名)
 +
 +<code>
 +username:*:1000:100:SambaUser:/var:/bin/false
 +</code>
 +
 +^ username | ユーザー名 |
 +^ * | '*' はパスワードログインを許可していないことを意味する。Samba の認証ユーザなので、OS自体にログインする必要はないので '*'。 \\ 'x' という文字か、暗号化されたパスワードを指定するとパスワードでログインできる。'x' はシャドウパスワードを使用している事を意味する。|
 +^ 1000 | ユーザーID。1000 以上の既に使用されていない数値を選ぶ。 |
 +^ 100 | グループID。users グループに所属させる。 |
 +^ SambaUser | コメント。氏名や部署名等。|
 +^ /var | ホームディレクトリを指定。ログインしないので、 /var を指定。 |
 +^ /bin/false | ユーザーのログインシェル。ログインしないので、 /bin/false を指定。 |
 +
 +
 +users グループに追加する。
 +
 +<code>
 +# vi /etc/group 
 +</code>
 +<code>
 +root:x:0:
 +daemon:x:1:
 +adm:x:4:
 +mail:x:8:
 +audio:x:29:
 +www-data:x:33:
 +ftp:x:55:
 +users:x:100:username
 +network:x:101:
 +nogroup:x:65534:
 +</code>
 +
 +
 +smbpasswd でユーザのパスワードを設定。新規の場合は -a オプションを付ける。変更の場合はオプションなし。
 +
 +<code>
 +# smbpasswd -a username
 +New SMB password:
 +Retype SMB password:
 +</code>
 +
 +
 +次は /etc/config/samba に設定を記述する。
 +
 +<code>
 +# vi /etc/config/samba
 +</code>
 +<code>
 +config samba
 +        option 'name'                   'openwrt'
 +        option 'workgroup'              'WORKGROUP'
 +        option 'description'            'openwrt'
 +        option 'homes'                  '0'
 +
 +config 'sambashare'
 +        option 'name' 'SambaShare'
 +        option 'path' '/mnt/usb-disk'
 +        option 'users' 'username'
 +        option 'guest_ok' 'no'
 +        option 'create_mask' '0755'
 +        option 'dir_mask' '0755'
 +        option 'read_only' 'no'
 +</code>
 +
 +
 +Samba に設定ファイルを再読み込みさせる。
 +
 +<code>
 +# /etc/init.d/samba restart
 +</code>
 +
 +
  
 ===== 設定 ===== ===== 設定 =====
行 37: 行 132:
  
 [[http://wiki.openwrt.org/doc/uci/samba|The UCI System >> Samba (smb)]] [[http://wiki.openwrt.org/doc/uci/samba|The UCI System >> Samba (smb)]]
 +
 +OpenWrt の Samba は設定ファイルが2つあるらしい。
 +
 +^ /etc/config/samba | 基本設定 |
 +^ /etc/samba/smb.conf.template | 詳細設定 |
 +
 +
 +/etc/config/samba は先ほど設定した。
 +
 +次は /etc/samba/smb.conf.template を編集する。
  
 <code> <code>
-# vi /etc/config/samba+# vi /etc/samba/smb.conf.template 
 +</code> 
 +<code> 
 +[global] 
 +        netbios name = |NAME| 
 +        display charset = UTF-8     
 +        interfaces = |INTERFACES| 
 +        server string = |DESCRIPTION| 
 +        unix charset = UTF-8     
 +        workgroup = |WORKGROUP| 
 +        browseable = yes 
 +        deadtime = 30 
 +        domain master = yes 
 +        encrypt passwords = true 
 +        enable core files = no 
 +        guest account = nobody 
 +        guest ok = no  
 +        invalid users = root 
 +        local master = yes 
 +        load printers = no 
 +        map to guest = Bad User 
 +        max protocol = SMB2 
 +        min receivefile size = 16384 
 +        null passwords = no  
 +        obey pam restrictions = yes 
 +        os level = 20 
 +        passdb backend = smbpasswd 
 +        preferred master = yes 
 +        printable = no 
 +        security = user 
 +        smb encrypt = disabled 
 +        smb passwd file = /etc/samba/smbpasswd 
 +        socket options = TCP_NODELAY IPTOS_LOWDELAY 
 +        syslog = 2 
 +        use sendfile = yes 
 +        writeable = yes
 </code> </code>
  
 +変更部分は以下。
  
 +^ display charset = UTF-8 | 日本語のファイル名も扱えるように UTF8 を使用。 |
 +^ unix charset = UTF-8 | 日本語のファイル名も扱えるように UTF8 を使用。 |
 +^ guest ok = no | guest ユーザはすべて不許可に変更。 |
 +^ null passwords = no | すべてのユーザにパスワード認証を要求するように変更。 |
 +
 +
 +===== 起動 =====
 +
 +Samba を再起動し設定ファイルを再読み込みする。
 +
 +<code>
 +# /etc/init.d/samba restart
 +</code>
  
  
openwrt/install-samba.1364017599.txt.gz · 最終更新: 2013/03/23 14:46 by admin