Windows 向けファイルサーバ
hackkit
samba をインストールして、Windows のファイルサーバにします。
samba のインストール
hackkit:~# apt-get install samba
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libcups2 libkeyutils1 libkrb53 libldap-2.4-2 libtalloc1 libwbclient0
samba-common ucf
Suggested packages:
cups-common krb5-doc krb5-user smbldap-tools ldb-tools
The following NEW packages will be installed:
libcups2 libkeyutils1 libkrb53 libldap-2.4-2 libtalloc1 libwbclient0 samba
samba-common ucf
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 8596kB of archives.
After this operation, 23.0MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp.jp.debian.org lenny/main libkeyutils1 1.2-9 [5228B]
Get:2 http://ftp.jp.debian.org lenny/main libkrb53 1.6.dfsg.4~beta1-4 [446kB]
Get:3 http://ftp.jp.debian.org lenny/main libldap-2.4-2 2.4.11-1 [179kB]
Get:4 http://ftp.jp.debian.org lenny/main ucf 3.0011 [61.8kB]
Get:5 http://ftp.jp.debian.org lenny/main libcups2 1.3.8-1lenny4 [157kB]
Get:6 http://ftp.jp.debian.org lenny/main libtalloc1 1.2.0~git20080616-1 [13.3kB]
Get:7 http://ftp.jp.debian.org lenny/main libwbclient0 2:3.2.5-2 [77.8kB]
Get:8 http://ftp.jp.debian.org lenny/main samba-common 2:3.2.5-2 [3364kB]
Get:9 http://ftp.jp.debian.org lenny/main samba 2:3.2.5-2 [4292kB]
Fetched 8596kB in 21s (396kB/s)
Preconfiguring packages ...
Package configuration
lqqqqqqqqqqqqqqqqqqqqqqqqqqqqu Samba Server tqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x Please specify the workgroup you want this server to appear to be in x
x when queried by clients. Note that this parameter also controls the x
x domain name used with the security=domain setting. x
x x
x Workgroup/Domain Name: x
x x
x YAMASITA______________________________________________________________ x
x x
x <Ok> x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
Package configuration
lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu Samba Server tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x x
x If your computer gets IP address information from a DHCP server on the x
x network, the DHCP server may also provide information about WINS servers x
x ("NetBIOS name servers") present on the network. This requires a change x
x to your smb.conf file so that DHCP-provided WINS settings will x
x automatically be read from /etc/samba/dhcp.conf. x
x x
x The dhcp3-client package must be installed to take advantage of this x
x feature. x
x x
x Modify smb.conf to use WINS settings from DHCP? x
x x
x <Yes> <No> x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
Selecting previously deselected package libkeyutils1.
(Reading database ... 10737 files and directories currently installed.)
Unpacking libkeyutils1 (from .../libkeyutils1_1.2-9_armel.deb) ...
Selecting previously deselected package libkrb53.
Unpacking libkrb53 (from .../libkrb53_1.6.dfsg.4~beta1-4_armel.deb) ...
Selecting previously deselected package libldap-2.4-2.
Unpacking libldap-2.4-2 (from .../libldap-2.4-2_2.4.11-1_armel.deb) ...
Selecting previously deselected package ucf.
Unpacking ucf (from .../archives/ucf_3.0011_all.deb) ...
Moving old data out of the way
Selecting previously deselected package libcups2.
Unpacking libcups2 (from .../libcups2_1.3.8-1lenny4_armel.deb) ...
Selecting previously deselected package libtalloc1.
Unpacking libtalloc1 (from .../libtalloc1_1.2.0~git20080616-1_armel.deb) ...
Selecting previously deselected package libwbclient0.
Unpacking libwbclient0 (from .../libwbclient0_2%3a3.2.5-2_armel.deb) ...
Selecting previously deselected package samba-common.
Unpacking samba-common (from .../samba-common_2%3a3.2.5-2_armel.deb) ...
Selecting previously deselected package samba.
Unpacking samba (from .../samba_2%3a3.2.5-2_armel.deb) ...
Processing triggers for man-db ...
Setting up ntp (1:4.2.4p4+dfsg-7) ...
Starting NTP server: ntpd.
Setting up libkeyutils1 (1.2-9) ...
Setting up libkrb53 (1.6.dfsg.4~beta1-4) ...
Setting up libldap-2.4-2 (2.4.11-1) ...
Setting up ucf (3.0011) ...
Setting up libcups2 (1.3.8-1lenny4) ...
Setting up libtalloc1 (1.2.0~git20080616-1) ...
Setting up libwbclient0 (2:3.2.5-2) ...
Setting up samba-common (2:3.2.5-2) ...
Creating config file /etc/samba/smb.conf with new version
Setting up samba (2:3.2.5-2) ...
Generating /etc/default/samba...
tdbsam_open: Converting version 0 database to version 3.
account_policy_get: tdb_fetch_uint32 failed for field 1 (min password length), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 2 (password history), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 3 (user must logon to change password), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 4 (maximum password age), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 5 (minimum password age), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 6 (lockout duration), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 7 (reset count minutes), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 8 (bad lockout attempt), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 9 (disconnect time), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 10 (refuse machine password change), returning 0
Importing account for root...ok
Importing account for daemon...ok
Importing account for bin...ok
Importing account for sys...ok
Importing account for sync...ok
Importing account for games...ok
Importing account for man...ok
Importing account for lp...ok
Importing account for mail...ok
Importing account for news...ok
Importing account for uucp...ok
Importing account for proxy...ok
Importing account for www-data...ok
Importing account for backup...ok
Importing account for list...ok
Importing account for irc...ok
Importing account for gnats...ok
Importing account for nobody...ok
Importing account for libuuid...ok
Importing account for telnetd...ok
Importing account for yasunari...ok
Importing account for ntp...ok
Adding group `sambashare' (GID 105) ...
Done.
Starting Samba daemons: nmbd smbd.
hackkit:~#
WORKGROUP はお使いのワークグループ名を、それ以外はデフォルトを指定します。
smb.conf の修正
/etc/samba/smb.conf を修正して /mnt を共有します。
hackkit:~# cd /etc/samba/
hackkit:/etc/samba# mv smb.conf smb.conf.orig
hackkit:/etc/samba# cp smb.conf.orig smb.conf
hackkit:/etc/samba# ls -l smb.conf*
-rw-r--r-- 1 root root 11920 Jan 6 22:08 smb.conf
-rw-r--r-- 1 root root 11920 Dec 27 2028 smb.conf.orig
hackkit:/etc/samba# vi smb.conf
:
:
hackkit:/etc/samba# diff -c smb.conf.orig smb.conf
*** smb.conf.orig Wed Dec 27 23:57:26 2028
--- smb.conf Tue Jan 6 22:17:31 2009
***************
*** 324,326 ****
--- 324,332 ----
; preexec = /bin/mount /cdrom
; postexec = /bin/umount /cdrom
+ [hackkit]
+ comment = hackkit share
+ path = /mnt
+ writable = Yes
+ create mask = 0660
+ directory mask = 0770
hackkit:/etc/samba#
修正が終われば smb.conf を再読込みします。
hackkit:/etc/samba# /etc/init.d/samba reload
Reloading /etc/samba/smb.conf: smbd only.
hackkit:/etc/samba#
ユーザの作成
hackkit:/etc/samba# smbpasswd -a yasunari
New SMB password:
Retype new SMB password:
hackkit:/etc/samba#
共有フォルダの作成
hackkit:/etc/samba# mkdir /mnt/share
hackkit:/etc/samba# chgrp yamasita /mnt/share/
hackkit:/etc/samba# chmod g+w /mnt/share
hackkit:/etc/samba#
確認
Windows エクスプローラから \\hackkit\hackkit にアクセスでき、
share フォルダが読み書きできることを確認します。
第三世代 LinkStation/玄箱をハックしよう
LinkStation/玄箱をハックしよう
Copyright (C) 2008-2010 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市