01647

ustreamer-01647

Lubuntuにsambaを再インストールした

Lubuntu 13.04を13.10へアップグレードした.その際,sambaがうまく更新されなかった.

samba削除

$ sudo apt-get autoremove samba4 samba

以下のパッケージは「削除」されます:
  attr bind9 bind9utils g++-4.7 gir1.2-gtksource-3.0 init-system-helpers
  ldb-tools libdcerpc-server0 libdcerpc0 libgd2-xpm libgensec0
  libgnome-desktop-3-4 libgphoto2-2 libgphoto2-port0 libgusb2 libhdb9-heimdal
  libkdc2-heimdal libldb1 libllvm3.2 libmenu-cache2 libmpc2 libndr-standard0
  libndr0 libobrender27 libobt0 libpoppler28 libregistry0
  libsamba-credentials0 libsamba-hostconfig0 libsamba-policy0 libsamba-util0
  libsamdb0 libsmbclient-raw0 libstdc++6-4.7-dev libuser1 libzeitgeist-1.0-1
  lubuntu-artwork-13-04 python-dnspython python-ldb python-libuser
  python-samba python-talloc python-tdb samba samba-dsdb-modules samba4
  samba4-common-bin system-config-samba tdb-tools ttf-droid ttf-liberation

dpkg: 警告: init-system-helpers の削除中、ディレクトリ '/var/lib/systemd' が空でないため削除できませんでした

$ sudo rm /etc/samba/*

sambaインストール

$ sudo apt-get install samba samba4
提案パッケージ:
  bind9-doc openbsd-inetd inet-superserver smbldap-tools phpldapadmin
  samba-gtk swat2
以下のパッケージが新たにインストールされます:
  attr bind9 bind9utils init-system-helpers ldb-tools libdcerpc-server0
  libdcerpc0 libgensec0 libhdb9-heimdal libkdc2-heimdal libldb1
  libndr-standard0 libndr0 libregistry0 libsamba-credentials0
  libsamba-hostconfig0 libsamba-policy0 libsamba-util0 libsamdb0
  libsmbclient-raw0 python-dnspython python-ldb python-samba python-talloc
  python-tdb samba samba-dsdb-modules samba4 samba4-common-bin tdb-tools

$ sudo apt-get install system-config-samba

以下のパッケージが新たにインストールされます:
  libuser1 python-libuser system-config-samba

samba設定

ユーザを作成する.

$ sudo smbpasswd -a ユーザ名
Can't load /etc/samba/smb.conf - run testparm to debug it
$ sudo touch /etc/samba/smb.conf
$ sudo smbpasswd -a ユーザ名
New SMB password:
Retype new SMB password:

smb.confが無いと進まないようだ.さて,設定ファイル/etc/samba/smb.conf を作る.

[global]

system-config-sambaを実行して,適当に設定する.

f:id:paulga:20131027182405p:plain

[global]
	workgroup = workgroup
;	server string = samba 3.6.18
	username map = /etc/samba/smbusers
	security = user
;	encrypt passwords = yes
;	guest ok = no
;	guest account = nobody

[share]
	path = /home/ユーザ名/share
	writeable = yes
;	browseable = yes
	valid users = paul

samba再起動

sudo service smbd restart

よく分からなくて使えなかったSWAT

$ sudo apt-get install swat

以下のパッケージが新たにインストールされます:
  openbsd-inetd samba-doc swat tcpd

openbsd-inetd経由でHTTPサーバが901番ポートで開始される.http://localhost:901/ にアクセスする.sambaのユーザ名とパスワードを問われる.

f:id:paulga:20131027183008p:plain

smb.confが644だと.666にすると.所有者をopenbsd-inetにすると読み書き可能になるかもしれない.

そんな名のユーザは居なかった.chown www-data:www-dataしてもchmod 644してもどうにもならなかった.所有者root,パーミッション644に戻し,SWATを削除する.sudo apt-get autoremove swat

その他原稿

system-config-sambaについてうまく行かなかった.端末から起動してみる.

$ sudo system-config-samba 
Traceback (most recent call last):
  File "/usr/share/system-config-samba/mainWindow.py", line 425, in onBasicPreferencesClicked
    self.basic_preferences_win.showWindow()
  File "/usr/share/system-config-samba/basicPreferencesWin.py", line 113, in showWindow
    self.readFile()
  File "/usr/share/system-config-samba/basicPreferencesWin.py", line 125, in readFile
    section = self.samba_sections_dict["[global]"]
KeyError: '[global]'

stderrさんありがとう.sudoして,[global]セクションを作っておくと何とかなるんじゃないかと思った.何とかなった.

invoke-rc.d: initscript samba, action "restart" failed.

「samba再起動のためにservice samba restartするが失敗した」だろう.sudo /etc/init.d/samba restartだか何だかをするしかない.いやサービス名はsmbdが正解らしい.sudo service smbd restartであるべきだと.

リンク