|
Sams Teach Yourself Samba in 24 Hours |
||||||||||||||||||||||||||
|
Hour 4: Installing and Testing the Configuration |
||||||||||||||||||||||||||
|
The first part of the problem that I'll examine is how to configure a network drive to allow multiple users read and write access. Figure 4.2 gives an example of a situation where the users, joe and boss, need to access files from the disk share depicted on the right. The diagrams illustrate the capability of allowing both users to read a file at the same time, but I allow only one user at a time to open a file for writing.
Before I create the directory that will be accessed by Joe and your boss, I first must make sure that each one has a valid account in /etc/passwd (or the network equivalent in the case of NIS or NIS+). Next, I create a group in /etc/group (or the network equivalent map) and add the two accounts as members. For this example, I call the group boss1 and use the usernames joe and boss.
Figure
4.2
Multiple users accessing files in a shared directory.
The step would be identical if I was setting up a shared directory for access via UNIX because Samba allows the underlying operating system to control access to the files. Therefore, I am able to use a model of security with which I am familiar even though the Windows clients have no notion of UNIX.
I generally use the /export/ directory for all disk shares, so I'll stick to that convention here. I'll create a directory named /export/smb/boss1/ to be the shared directory. Figure 4.3 displays a portion of the server's directory structure. The directory that will be shared via SMB has been circled.
Figure
4.3
UNIX directory tree and the portion which will be shared via Samba.
Next, set the group ownership and permissions using the following commands:
chgrp boss1 /export/boss1 chmod 770 /export/boss1 chmod g+s /export/boss1
The last step to perform is to define the share in Samba's configuration file by adding the following settings to smb.conf:
; share name
[boss1]
; text to list when browsing the share from a client
comment = Shared directory for group boss1
; absolute path to the disk directory
path = /export/boss1
; should the share be writeable?
writeable = yes
; user allowed to connect to the share
; the `@' is used to designate a unix group
valid users = @boss1
; enforce file locking?
locking = yes
; default file creation permission mask
create mode = 0660
; default directory creation permission mask
directory mode = 0770
Again, I've included comments to describe the general meaning of each parameter. It is not necessary at the moment to understand exactly what function each one serves. Disk shares are discussed in depth in Hour 7, "File Sharing."
|
Sams Teach Yourself Samba in 24 Hours |
||||||||||||||||||||||||||
|
Hour 4: Installing and Testing the Configuration |
||||||||||||||||||||||||||
|
© Copyright Macmillan USA. All rights reserved.