Resource Share/Access Example

The following examples illustrate a possible command line user interface for a server to offer a disk resource, and for a client to connect to and use that resource.

a) NET SHARE

The net share command, when executed on the server, specifies a directory name to be made available to clients on the network. A share name must be given, and this name is presented by clients wishing to access the directory.

Examples:

NET SHARE src=c:\dir1\src "bonzo"

assigns password bonzo to all files within directory c:\dir1\src and its subdirectories with the share name src being the name used to connect to this resource.

NET SHARE c=c:\ " " RO

NET SHARE work=c:\work "flipper" RW

offers read-only access to everything on the c drive. Offers read-write access to all files within the c:\work directory and its subdirectories.

The above example is appropriate for servers operating as a share level server. A user level server would not require the permissions or password, since the combination of the client's account name and specific access control lists on files is sufficient to govern access.

b) NET USE

Clients can gain access to one or more offered directories via the net use command. Once the net use command is issued the user can access the files freely without further special requirements.

Examples:

1. NET USE d: \\Server1\src "bonzo"

gains full access to the files and directories on Server1 matching the offer defined by the netname src with the password of bonzo. The user may now address files on server1 c:\dir1\src by referencing d:. E.g. "type d:srcfile1.c".

2. NET USE e: \\Server1\c

3. NET USE f: \\Server1\work "flipper"

Now any read request to any file on that node (drive c) is valid (e.g. "type e:\bin\foo.bat"). Read-write requests only succeed to files whose pathnames start with f: (e.g. "copy foo f:foo.tmp" copies foo to Server1 c:\work\foo.tmp).

For user level servers, the client would not provide a password with the net use command.

The client software must remember the drive identifier supplied with the NET USE request and associate it with the tid value returned by the server in the SMB header. Subsequent requests using this tid must include only the pathname relative to the connected subtree as the server treats the subtree as the root directory (virtual root). When the user references one of the remote drives, the client software looks through its list of drives for that node and includes the tree id associated with this drive in the tid field of each request.

Note that one shares a directory and all files underneath that directory are then affected. If a particular file is within the range of multiple shares, connecting to any of the share ranges gains access to the file with the permissions specified for the offer named in the NET USE. The server will not check for nested directories with more restrictive permissions.