Windows Vista in a Nutshell: A Desktop Quick Reference (In a Nutshell (OReilly))

7.5. Sharing Resources and Files

There's little point in setting up a network with multiple computers if you don't take advantage of the connection by sharing files and printers. Once you've established a network connection with another Windows computer and verified that the connection is working, you can set up resources to be shared over your network.

A shared resource is a folder on your hard disk, a printer physically attached to your computer, or some other device that you would like to share with other computers on your network. If you share a printer, others on your network can print to it; if you share a folder, others on your network can access the files and folders contained therein as though they were stored on their own hard disks.

Whenever you share a resource, you are opening a backdoor to your computer. It's important to keep security in mind at all times, especially if you're connected to the Internet. Otherwise, you may be unwittingly exposing your personal data to intruders looking for anything they can use and abuse. Furthermore, an insecure system is more vulnerable to viruses and other malicious programs.

To start sharing resources, you first need to enable sharing on your PC. Open the Network and Sharing Center (Figure 7-33) by choosing Control Panel Set up file sharing, or Control Panel [Network and Internet] Network and Sharing Center.

Figure 7-33. The first step to sharing resourcesconfiguring the Network and Sharing Center properly

Set up sharing in the Sharing and Discovery section. Here are your options:

Network discovery

Turn network discovery on; if you don't, you won't be able to see other network computers and devices, your PC won't be visible to other network computers and devices, and sharing will be impossible.

File sharing

Turn this on if you want to be able to share files and folders from your PC with other network users.

Public folder sharing

This lets you share files in your Public folder with other network users. You can do this kind of sharing in concert with file sharing, as detailed earlier, or by itself. When you share files via the Public folder, you have to move files and folders into the Public folder in order for other people to get access to them. When you turn on this type of file sharing, the Public folder will show up on other computers on the network. To get it on your network, open Windows Explorer and go to the Public folder (c:\Users\Public). Drag files and folders into that folder to share them.

With Public folder sharing, you have three choices:

  • Allow anyone with network access to view files but not change or create files in the Public folder.

  • Allow anyone with network access to view, change, and create files.

  • Stop sharing the Public folder. Other accounts on your computer will still be able to access the folder, though.

Password-protected sharing

If you turn this on, only people who have an account on your computer can access shared files and printers in the Public folder and in other folders. If you turn it off, no account or password will be needed. Note that if neither file sharing nor public folder sharing is turned on, this option will have no effect.

Media sharing

This allows people and devices on the network to share music, pictures, and videos on your PC, and for you to access other people's shared media.

Once you've set your sharing options, you can share files and folders. Here's how to do it for Public folders, as well as any files and folders on your system.

7.5.1. Sharing Public Folders

The Public folder, by default, contains these subfolders:

  • Public Documents

  • Public Downloads

  • Public Favorites (Hidden)

  • Public Music

  • Public Pictures

  • Public Videos

  • Public Desktop (Hidden)

The subfolders are empty. Simply place any folders or files in the appropriate folders, or make new folders and put them there. They'll now be available to anyone with network access. At any point, you can change access rights to those folders by going to the Network and Internet control panel.

7.5.2. Sharing Other Folders

To share a folder not in the Public folder, right-click it, select Share, and choose the appropriate options from the screen that appears, as shown in Figure 7-34.

Figure 7-34. Using the File Sharing dialog to share a folder and set its access privileges

You'll see accounts and account groups listed, and next to each account, its permission level. Here are the choices, and what each means:

Reader

The person or group can only view files.

Contributor

The person or group can view files, add files, and change or delete the files that they add. They cannot, however, change or delete files that others have added.

Co-owner

The person or group can view files, add files, and change and delete all files in the folder, even those created by others.

Owner

As with the co-owner, the person or group can view files, add files, and change and delete all files in the folder, even those created by others. Only the person who actually created the folder will be listed as an owner.

Configure each account and account group. The Everyone group, as the name implies, covers everyone who connects to your PC, except for other users you specifically configure on this screen. Permissions are inherited, which means if you configure the permissions for a folder, those permissions will be active for all subfolders and their contents. However, you can set rather liberal permissions for, say, a drive, and then selectively restrict access for the more sensitive folders contained therein.

If you want to add new accounts or groups to let them access your shared folders, click the down arrow in the input box next to the Add button, choose from the list that appears, and click Add. Choose "Create a new user" and follow the prompts if you want to create a new user account for accessing your folders.

When you're done, click the Share button, and the folder will be shared with the permissions you specified. You'll see the notification shown in Figure 7-35, which shows you the shared name and location of the folder.

Figure 7-35. The notification showing you the folder's shared name and location

Note that if you've turned on password-protected sharing, only people who have a user account and password on your PC will be able to access the shared folder. This means that you need to make sure that your user accounts are in order before others on your network are able to access your shared resources. With password-protected sharing, every user who wants to access data on your computer remotely (that is, through the network connection) must have a user account on your computer. For example, if you're logged in as "Lenny," you'll be able to access resources only on other computers that also have an account called "Lenny" and that have the same password configured for that account. If you have two Windows Vista machines, one with a "Lenny" account and one with a "Lenny" and a "Karl" account, a user logged in as "Karl" will be able to access resources only on the second machine. Of course, if you turn off password-protected sharing, anyone on the network will be able to access data from your PC remotely.

If you have a network that mixes Windows Vista and Windows XP PCs and/or Windows 2000 PCs, your Windows XP and 2000 PCs may have a difficult time accessing shared files and folders on your Vista PC. The problem may be caused because the Windows XP and Windows 2000 PCs are on a different workgroup than the Windows Vista PCs. Different versions of Windows use different default names for workgroups, so you may need to change them so that they match. In fact, if you've renamed your workgroups, you can run into the same problem even if you have a Vista-only network. To solve the problem in Windows XP, change the workgroup for each XP-based PC. In Windows XP, right-click My Computer, select Properties, and select the Computer Name tab. In the Workgroup area, click Change, and type in the name of the workgroup to which the Windows Vista PC belongs, then click OK. You should be able to gain access to folders and files on the Windows Vista PC now. To change the workgroup name in Windows Vista, see "Change Workgroup or Domain," earlier in this chapter.

Once a folder has been shared, and assuming the user accounts are set up properly, you can access the folder from another computer via the Network and Sharing Center, in particular from the Network Map (click "View full map" from the Network and Sharing Center), as shown in Figure 7-36.

Figure 7-36. The Network Map, which shows you all the devices on your network and gives you access to them

Click any computer on the network, and you'll see all the folders and devices it shares, as you can see in Figure 7-37. This shows several shared folders on the computer called VISTA-DESKTOP. Note that several of the folders have small circular icons beneath them. That means that those are offline folders that synchronize between two PCs. For details, see "Sync Center," later in this chapter.

Figure 7-37. Connecting to another PC on the network and seeing its shared folders and devices

Note that you don't have to go through the Network and Sharing Center in order to connect to other shared folders on your network. You can also open Windows Explorer and click Network in the Folders area, and you'll see a list of all PCs connected to your network, as you can see in Figure 7-38. Open them to browse to their shared folders.

Figure 7-38. Viewing other PCs on the network via Windows Explorer

Don't confuse file synchronization with sharing folders. When you synchronize (sync) a file, you keep an identical copy of it in several locations. When changes are made to one of those copies, they are automatically applied to the other one as well. When you share a file, other people on the same network can access that file, but the file is available only in that one location.

The full path to a network resource (called a UNC path, for Universal Naming Convention) looks a little different from a standard path. For example, the path to a shared folder called Budget2007, located on a computer called Barney, will look like this:

\\Barney\Budget2007

7.5.3. Sharing Printers

Printers are shared in much the same way that folders are. First, on the computer to which the printer is attached, go to the Network and Sharing Center and turn on Printer sharing. Then go to the PC on which you want to use that shared printer and choose Control Panel Hardware and Sound Add a printer, and follow the wizard for adding a printer. For details, see "Add Printer," in Chapter 9.

7.5.4. Mapping Drives

Don't like to use multiple clicks to connect to a shared folder or networked PCs? You can instead have folders or PCs show up in Windows Explorer as drives. They'll appear in the Network Locations area, as well as in the Folders area, as you can see in Figure 7-39. Connect to them as you would any other folder.

Figure 7-39. Several mapped network drives

To map a drive, click Map Network Drive on the Windows Explorer toolbar. The Map Network Drive dialog appears. Click Browse and then double-click the Network icon that appears. A list of the PCs on your network appears. (See Figure 7-40.) Choose the PC or folder on a PC that you want to map, click OK, and from the Map Network Drive dialog, select the drive letter. Click Finish. If you want to automatically reconnect to the network drives whenever you log on, keep the box checked next to "Reconnect at logon."

Figure 7-40. Mapping a network drive

Create A Shared Folder: \windows\system32\shrpubw.exe

Share a folder with other users on a network.

To open

Command Prompt shrpubw

Usage

shrpubw [\foldername]

Description

The easiest way to begin sharing a folder or drive is to right-click on its icon in Explorer, select Share, and fill in the file-sharing form. But if you want to create a new folder and share it in a single step, a better bet is the Create A Shared Folder Wizard (Figure 7-41), which you can invoke with the shrpubw command.

Figure 7-41. The Create A Shared Folder Wizard, which provides an alternate way to share any folder on your hard disk with other computers on your network

The interface is extremely simple. Below the Computer field (which can't be changed once the program has started), there are three other fields:

Folder to share

Enter the full path of the folder you want to begin sharing (e.g., c:\my stuff\) or click Browse to navigate the folder tree. You can also create a new folder here.

Share name

Enter the name under which the folder will be known on the network (e.g., my stuff).

Share description

The description is optional, but a quick note describing the purpose of the folder can be very helpful, especially in large organizations. For example: Lenny's Stuff.

When you're done, click Next to view the second and final page. Here, you can specify the security options for the share, such as which users will be able to read and/or modify the data in the shared folder. Click Finish when you're done.

Notes

  • The wizard also allows you to create shared folders on other computers attached to the network, as long as you have administrative rights to them, by using the syntax shrpubw /s computer_name where computer_name is the name of the computer on which you want to share or create a folder.

See also

"User Accounts," in Chapter 10

Категории