Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Absolute BSD - The Ultimate Guide To FreeBSD (2002).pdf
Скачиваний:
25
Добавлен:
17.08.2013
Размер:
8.15 Mб
Скачать

So our password is correct. Let's see what resources this server offers with smbutil's view command:

...............................................................................................

# smbutil view //unix@fileserv4

Password:

 

 

Share

Type

Comment

−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

jsmith$ disk gdonner$ disk mlucas$ disk

...

...............................................................................................

You'll get a list of every shared resource on the SMB server.

Now, assuming you're finished, log out of the server:

...............................................................................................

# smbutil logout //mlucas@fileserv4

Password:

Connection unmarked as permanent and will be closed when possible

#

...............................................................................................

Mounting a Share

Now that you've finished investigating, let's actually mount a share with mount_smbfs(8). The syntax is as follows:

...............................................................................................

mount_smbfs //username@servername/share /mount/point

...............................................................................................

I have a share on the fileserver called mlucas. To mount my personal fileserver share on my FreeBSD box as /home/mwlucas/smbmount, I would do this:

...............................................................................................

# mount_smbfs //mlucas@fileserv4/mlucas /home/mwlucas/smbmount

...............................................................................................

Check your work with df(1).

...............................................................................................

# df

 

 

 

 

 

 

Filesystem

1K−blocks

Used

Avail

Capacity Mounted on

/dev/ad0s1a

 

99183

49105

42144

54%

/

/dev/ad0s1f

 

5186362

3091500

1679954

65%

/usr

/dev/ad0s1e

 

198399

22816

159712

12%

/var

procfs

 

4

4

0

100%

/proc

//MLUCAS@FILESERV4/MLUCAS

128000

54320

73680

42%

 

/usr/home/mwlucas/smbmount

 

 

 

 

 

#

 

 

 

 

 

 

...............................................................................................

479

I can now do basic file operations, including using Emacs and StarOffice on the documents in this shared drive. Life just got a little better.

Other mount_smbfs Options

Mount_smbfs includes several options to control how the system behaves. Use mount_smbfs's −f option to choose a different file permission mode, and the −d option to choose a different directory permission mode. For example, to set a mount so that only I can access the contents of this directory, I would use mount_smbfs −d 700. (This would make the UNIX permissions far more stringent than the Windows ones, but that's not my concern at the moment.) I can even change the owner with the −u option, and the group with the −g option.

The −I option tells mount_smbfs to skip the NetBIOS name resolution, and to only use the hostname or IP address provided on the command line instead.

The −N option tells mount_smbfs to read the password from the configuration file, and not to prompt for one. This means that you need to have your clear−text password in nsmb.conf, as discussed earlier.

The −W flag specifies a new workgroup. It overrides any settings in nsmb.conf.

The Windows filesystem, and hence SMB, uses case−insensitive filenames, but UNIX is case sensitive. SMBFS defaults to leaving the case as it finds it, but that may not be what you want. Use the −c flag to tell mount_smbfs to change the case on files on SMB filesystems: −c l changes everything to lowercase, while −c u changes everything to uppercase.

When working with mount_smbfs, I've found it flexible enough to handle almost any situation on a Windows network, thus allowing you to use your FreeBSD system seamlessly with the rest of the office.

Sample nsmb.conf Entries

You can customize the nsmb.conf file to use different usernames to access different shares or to bypass NetBIOS name resolution for particular hosts. Here are some more complicated examples, using the configuration entries we defined earlier.

All of our advanced samples here assume that they're part of the configuration that includes this bare−minimum entry:

...............................................................................................

[default]

workgroup=EXAMPLE

nbns=192.168.2.80

username=mlucas

...............................................................................................

480