Ubuntu > sambaをインストール
更新日
2015-01-03
広告
Ubuntuマシンにsambaをセットアップして、windowsマシンとファイル共有する方法を紹介します。
sambaのインストール
インストールはapt-getで可能です。~$ suto apt-get install sambaこれでsamba (smbd)がインストールされます。 /etc/init.d/smbd スクリプトで、sambaの起動や停止が可能です。
パスワードの設定
ユーザtaroの、samba用のパスワードを設定します。~$ smbpasswd New SMB password: Retype new SMB password:好きなパスワードを設定してください。
smb.confの設定
sambaの設定は/etc/samba/smb.conf で行います。 windowsマシンのworkgroup名に合わせて、globalセクションの設定を変更します。 例えば、ワークグループが'MSHOME'の場合は、以下のように設定します。[global] section workgroup = MSHOMEさらに、[homes]セクションのコメントを外します。
======================= Share Definitions ======================= # Un-comment the following (and tweak the other settings below to suit) # to enable the default home directory shares. This will share each # user's home directory as \\server\username [homes] comment = Home Directories browseable = no # By default, the home directories are exported read-only. Change the # next parameter to 'no' if you want to be able to write to them. read only = yes # File creation mask is set to 0700 for security reasons. If you want to # create files with group=rw permissions, set next parameter to 0775. create mask = 0700 # Directory creation mask is set to 0700 for security reasons. If you want to # create dirs. with group=rw permissions, set next parameter to 0775. directory mask = 0700 # By default, \\server\username shares can be connected to by anyone # with access to the samba server. Un-comment the following parameter # to make sure that only "username" can connect to \\server\username # This might need tweaking when using external authentication schemes valid users = %S
上記の設定は、以下の意味になります。
- windowsマシンからは「読み込みのみ可能」
- ユーザのホームディレクトリを共有
- ファイルやディレクトリを生成した場合のパーミッションは700(そもそもread onlyの設定ではありますが)
windowsマシンのexplorerのアドレスバーに '\\sambaマシンのアドレス\homes' と入力すると、パスワードのダイアログが表示されます。先ほど設定したsamba用パスワードを入力しましょう。explorerに、Ubuntuマシンのユーザtaroのホームディレクトリが表示されるはずです。
設定ファイルの検証
testparmコマンドで、設定ファイルの記述内容にミスがないか検証できます。引数なしでtestparmコマンドを実行すれば、デフォルトで/etc/samba/smb.confを検証してくれます。$ testparm Load smb config files from /etc/samba/smb.conf rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384) :
広告
お問い合わせは sweng.tips@gmail.com まで。