LX-SVS-INFO-samba
Updated sep/23/10 09:50
Het installeren van de samba server is kinderspel, shares aanmaken en activeren is ook niet moeilijk, het aanmaken van de users wordt wel eens vergeten.
# apt-get install samba
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
samba-common
Suggested packages:
smbldap-tools ldb-tools
The following NEW packages will be installed:
samba samba-common
0 upgraded, 2 newly installed, 0 to remove and 146 not upgraded.
Need to get 7706kB of archives.
After this operation, 21.3MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp.belnet.be lenny/main samba-common 2:3.2.5-4lenny11 [3408kB]
Get:2 http://ftp.belnet.be lenny/main samba 2:3.2.5-4lenny11 [4298kB]
Fetched 7706kB in 3s (2306kB/s)
Preconfiguring packages ...
Selecting previously deselected package samba-common.
(Reading database ... 88029 files and directories currently installed.)
Unpacking samba-common (from .../samba-common_2%3a3.2.5-4lenny11_i386.deb) ...
Selecting previously deselected package samba.
Unpacking samba (from .../samba_2%3a3.2.5-4lenny11_i386.deb) ...
Processing triggers for man-db ...
Setting up samba-common (2:3.2.5-4lenny11) ...
Creating config file /etc/samba/smb.conf with new version
Setting up samba (2:3.2.5-4lenny11) ...
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
...
Importing account for root...ok
Importing account for daemon...ok
Importing account for bin...ok
...
Importing account for hplip...ok
Importing account for user...ok
Importing account for sshd...ok
Adding group `sambashare' (GID 116) ...
Done.
Starting Samba daemons: nmbd smbd.
Je kan de volgende pop-up schermen beantwoorden als volgt:
Samba Server
Please specify the workgroup you want this server to appear to be in when queried by
clients. Note that this parameter also controls the domain name used with the security=domain setting. Workgroup/Domain Name: WORKGROUP <Ok>
|
If your computer gets IP address information from a DHCP server on the network, the DHCP server may also provide information about WINS servers ("NetBIOS name servers") present on the network. This requires a change to your smb.conf file so that DHCP-provided WINS settings will automatically be read from /etc/samba/dhcp.conf. The dhcp3-client package must be installed to take advantage of this feature. Modify smb.conf to use WINS settings from DHCP? <Yes> <No> |
Sla de default config op en begin een nieuwe configuratie:
# mv /etc/samba/smb.conf /etc/samba/smb.conf.example
# vim /etc/samba/smb.conf
[global]
workgroup=lokaal31 [brussel] path=/home/ketje comment=kommentaar |
Vergeet de directory in het path niet aan te maken en er iets in te stoppen:
# mkdir /home/ketje
# find /usr/share/pixmaps/ -iname *jpg -size +100k \# testparm
Load smb config files from /etc/samba/smb.conf
Processing section "[homes]"
Processing section "[images]"
Processing section "[w2003]"
Processing section "[public]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[global]
workgroup = lokaal31
[brussel]
comment = kommentaar
path = /home/ketje
Maak een gebruiker aan voor gebruik met samba, deze gebruiker moet ook bestaan onder linux:
# useradd jan
# smbpasswd -a jan
New SMB password: sdf12345
Retype new SMB password: sdf12345
Added user jan.
Eerst op je eigen computer:
# smbclient //localhost/brussel -U jan
Enter jan's password: sdf12345
Domain=[DEBIAN] OS=[Unix] Server=[Samba 3.2.5]
smb: \> ls
. D 0 Thu Sep 23 10:23:20 2010
.. D 0 Thu Sep 23 10:22:10 2010
GreenMeadow.jpg 183377 Thu Sep 23 10:23:20 2010
OpenFlower.jpg 370672 Thu Sep 23 10:23:20 2010
comet.jpg 141297 Thu Sep 23 10:23:20 2010
earth-horizon.jpg 210180 Thu Sep 23 10:23:20 2010
galaxy-ngc3370.jpg 152246 Thu Sep 23 10:23:20 2010
whirlpool.jpg 165943 Thu Sep 23 10:23:20 2010
cloud.jpg 323758 Thu Sep 23 10:23:20 2010
sombrero.jpg 107179 Thu Sep 23 10:23:20 2010
61335 blocks of size 131072. 39029 blocks available
smb: \> lcd ~
smb: \> get whirlpool.jpg
getting file \whirlpool.jpg of size 165943 as whirlpool.jpg (32410.1 kb/s) (average 32410.7 kb/s)
smb: \> quit
Daarna vanaf een andere PC, deze keer onder windows:
C:\>NET USE L: \\172.16.31.123\brussel /USER:jan
The password or user name is invalid for \\172.16.31.123\brussel.
Enter the password for 'jan' to connect to '172.16.31.123': sdf12345
The command completed successfully.
C:\>L:
L:\>dir
Volume in drive L is brussel
Volume Serial Number is 09BE-125A
Directory of L:\
23/09/2010 01:23 <DIR> .
23/09/2010 01:22 <DIR> ..
23/09/2010 01:23 183.377 GreenMeadow.jpg
23/09/2010 01:23 370.672 OpenFlower.jpg
23/09/2010 01:23 141.297 comet.jpg
23/09/2010 01:23 210.180 earth-horizon.jpg
23/09/2010 01:23 152.246 galaxy-ngc3370.jpg
23/09/2010 01:23 165.943 whirlpool.jpg
23/09/2010 01:23 323.758 cloud.jpg
23/09/2010 01:23 107.179 sombrero.jpg
8 File(s) 1.654.652 bytes
2 Dir(s) 5.115.314.176 bytes free
Om te kunnen schrijven voeg je het volgende toe in de /etc/samba/smb.conf onderaan je share declaratie:
writable=yes
Je kan ook alle homedirectories van je sambaserver sharen door de volgende declaraties toe te voegen:
[homes]
writable=yes
smb.conf ziet er dan uit als volgt:
[global]
workgroup=lokaal31
path=/home/ketje comment=kommentaar writable=yes[homes] writable=yes |