If you prefer to use a command-line utility to manage your servers, you're in luck—Windows 2000 includes an updated version of the Macfile utility included with Windows NT 4. Macfile provides a command-line interface that lets you manage FSM servers, MAVs, users, and files from a Windows 2000 command shell. Like the venerable Net User command, Macfile grows on you once you get used to it, because it makes short work of many common administrative tasks. Macfile actually has four separate functions:
The Macfile Server command lets you work with the same settings as the Configuration tab of the File Server For Macintosh Properties window you saw earlier in Figure 22-8. Here's the full version of the command:
MACFILE SERVER [/SERVER:\<I>computername] [/MAXSESSIONS:number | UNLIMITED] [/LOGINMESSAGE:message] [/GUESTSALLOWED: TRUE | FALSE]
If you want to add, remove, or reconfigure a MAV, the Macfile Volume command is the tool to use. This command actually has three separate modes, each triggered by its own command switch.
The least complex variant of Macfile Volume is the one that lets you remove existing MAVs. This isn't surprising, since removing a volume requires only that you specify the MAV you want removed (and, optionally, the server that hosts it). Here's what the command looks like:
MACFILE VOLUME /REMOVE [/SERVER:\<I>computername] /NAME:volumename
Adding a volume is pretty easy. When you create a new MAV using the Shared Folder Wizard, you provide settings as described earlier in this chapter. The only required settings are the name you want the MAV to have and the path to the folder the MAV sits on—and so it is with Macfile Volume /Add. The full version of the command is shown below. (Note that the /SERVER and /NAME switches work the same as they do with Macfile Volume /Remove.)
MACFILE VOLUME /ADD [/SERVER:\<I>computername] /NAME:volumename /PATH:filepath [/READONLY:TRUE|FALSE] [/GUESTSALLOWED:TRUE|FALSE] [/PASSWORD:password] [/MAXUSERS:number|UNLIMTED]
The Macfile Volume /Set command lets you change the settings supplied when you created the MAV; you can toggle its read-only status, specify whether guests may use it or not, set the volume password, and indicate how many users can use the MAV. The syntax is very similar to that needed for the /Add switch:
MACFILE VOLUME /SET [/SERVER:\<I>computername] /NAME:volumename [/READONLY:TRUE|FALSE] [/GUESTSALLOWED:TRUE|FALSE] [/PASSWORD:password] [/MAXUSERS:number|UNLIMITED]
The name Macfile Directory is a little misleading; Macfile Permissions might have been a better choice, since you use the command to assign permissions to a directory within a MAV (or to the directory that contains the MAV). You can individually assign an owner, assign a group, or set permissions for the owner or group. The command is shown below (The /SERVER and /PATH switches work as previously discussed.)
MACFILE DIRECTORY [/SERVER:\<I>computername] /PATH:directorypath [/OWNER:ownername] [/GROUP:groupname] [/PERMISSIONS:permsmask]
Table 22-1. What the bits in the /PERMISSIONS mask field mean
|1 (leftmost)||OwnerSeeFiles: 1 = the owner can see files in the folder; 0 = the owner can't see the files.|
|2||OwnerSeeFolders: 1 = the owner can see enclosed folders; 0 = the owner can't see the folders.|
|3||OwnerMakeChanges: 1 = the owner can make changes to the files and folders; 0 = the owner can't make changes.|
|4||GroupSeeFiles: 1 = members of the primary group can see files in the folder; 0 = members of the primary group can't see the files.|
|5||GroupSeeFolders: 1 = members of the primary group can see enclosed subfolders; 0 = members of the primary group can't see the subfolders.|
|6||GroupMakeChanges: 1 = members of the primary group can make changes to the files and folders; 0 = members of the primary group can't make changes.|
|7||WorldSeeFiles: 1 = Everyone can see files in the folder; 0 = Everyone can't see the files.|
|8||WorldSeeFolders: 1 = Everyone can see enclosed subfolders; 0 = Everyone can't see the subfolders.|
|9||WorldMakeChanges: 1 = Everyone can make changes to the files and folders; 0 = Everyone can't make changes.|
|10||Cannot Rename, Move, or Delete: Setting this bit to 1 is the same as locking the folder on the Mac OS side.|
|11 (rightmost)||Apply Changes Recursively: When this bit is set, the rest of the permissions mask you specify will be applied to all subfolders of the target folder. This is the equivalent of the standard Windows 2000 permission inheritance behavior.|
You must specify either the /OWNER, /GROUP, or /PERMISSIONS switches when you use Macfile Directory.
With one exception (when you turn on bit 11 in the mask for the /PERMISSIONS switch), none of these changes are applied recursively.
The remaining command, Macfile Forkize, is much like a Swiss Army knife—it has several useful functions that aren't needed often but that are occasionally really handy. You use Macfile Forkize to do two things: change the type or creator code for a file or combine the resource and data forks of a file. Here's the command syntax:
MACFILE FORKIZE /TARGETFILE:filepath [/SERVER:\\computername] [/TYPE:typecode] [/CREATOR:creatorcode] [/DATAFORK:filepath] [/RESOURCEFORK:filePath]
macfile forkize /targetfile:f:\shared\html\welcome.htm / type:TEXT /creator:DmWr
This is a quick way to fix up types and creators of existing files after you change the associations using the methods described earlier in this chapter (except that you can't use wildcards with the /TARGETFILE switch, so you'll need another way to process multiple files, like a short Windows Scripting Host [WSH] script).