sambaをインストール

パッケージインストール

  • samba-3.0.10-1.4E.9
  • samba-common-3.0.10-1.4E.9
  • samba-client-3.0.10-1.4E.9
  • samba-swat-3.0.10-1.4E.9

swatの設定(使わなかったけど一応)

[localhost], [xxx.xxx.xxx.xxx] からの接続を許可する

/etc/xinetd.d/swat (青字は追加/変更点)

service swat
{
 port = 901
 socket_type = stream
 wait = no
 only_from = 127.0.0.1 localhost xxx.xxx.xxx.xxx
 user = root
 server = /usr/sbin/swat
 log_on_failure += USERID
 disable = no
}

変更を反映

# /etc/init.d/xinetd restart

動作確認…ブラウザに以下のURLを入力

http://localhost:901/

smb.conf

/etc/samba/smb.conf

[global]
 hosts allow = xxx.xxx.xxx.xxx
[share]
 comment = share directory
 path = /var/www/html
 valid users = username
 public = no
 writable = yes
 printable = no
 create mask = 0765

※ [home], [printers]セクションもコメントアウト
※ path に username の書き込み権限があるか確認

sambaの起動&自動起動

# /etc/init.d/smb start
# chkconfig smb on

使用ユーザのsambaパスワード設定

# smbpasswd -a username

クライアント設定 (Windows)

  1. [マイネットワーク] → [コンピュータの検索] で IPアドレスを入力
  2. 検出されたマシンをダブルクリック
  3. smbpasswdで設定した、ユーザ名・パスワードを入力しログイン

クライアント設定 (Linux)

smbmount

# smbmount //hostname/share*1 /mnt/data -o username=username

smbclient ...あまり使わないっぽいけど

接続コマンド

# smbclient //hostname/share -U username%password

共有を表示

# smbclient -L hostname -U username%password

*1:share ...smb.confで[share]のように定義したもの