Networking with Ubuntu 8.04 and Windows Part 1

Wednesday Jun 25th 2008 by Eric Geier
Share:

Can't seem to find the shares of Ubuntu machines from My Network Places or Network in Windows? You'll soon find out it's not a hide-and-seek game you'll win unless you start playing with features that exist on the computer, rather than chasing those you imagine are installed and setup.

Can't seem to find the shares of Ubuntu machines from My Network Places or Network in Windows? You'll soon find out it's not a hide-and-seek game you'll win unless you start playing with features that exist on the computer, rather than chasing those you imagine are installed and setup.

Though Ubuntu can see the shared files and printers of Windows machines out-of-the-box, Windows can't see Ubuntu shares by default. However, don't give up yet and purchase another XP or Vista license; you can have Ubuntu 8.04 and Windows talking in no time.

Computers must have compatible resource sharing protocols installed in order to communicate with each other. Think of two people trying to talk to each other in different languages; nothing will be communicated until they speak a language they both understand. The same principal applies with the communication on a computer network.

By default, Ubuntu doesn't come with a protocol installed that gives it resource sharing capability. Therefore the first step is to install a protocol that will enable you to share files and printers. You have two main protocols you could use with Ubuntu: NFS (Network File System) developed by Sun Microsystems for Linux/Unix, and SMB (Server Message Block) primary used in Windows.

Windows uses SMB by default, thus installing the SMB protocol on your Ubuntu machine will get the conversation started by opening up two-way communication between the Microsoft operating system and Linux distribution. In the open-source World, the Samba package can give your Linux computer the SMB capability. The following steps show you exactly how to install the Samba package in Ubuntu:

  1. Click System | Administration | Synaptic Package Manager.
  2. On the prompt, enter your password and click OK.
  3. On the Synaptic Package Manager window, click the Search button, type samba into the Search field, and click the Search button.
  4. Wait a moment for the search to complete and the results to appear.
  5. Scroll down and right-click on the samba entry, and choose Mark for Installation as you can see in Figure 1.

If you can't find samba, refer to the next set of steps and then come back here.

  1. Click the Apply button on the Synaptic Package Manager toolbar, and then review changes on the Summary dialog box and click Apply.
  2. On the Changes Applied dialog box, click Close.
  3. Now you can close the Synaptic Package Manager.

If you don't see the samba package you may have disabled Ubuntu from searching the Main repository, or archive, of Ubuntu's officially supported software. If this is the case, you can follow these steps to enable the Main repository so you'll have access to the samba package:

  1. Click Settings | Repositories from the Synaptic Package Manager window.
  2. Select the Canonical-Supported Open Source Software (Main) checkbox and click the Close button.
  3. If prompted with the Repositories Changed dialog box, click the Close button.
  4. On Synaptic Package Manager toolbar, click the Reload button and proceed with the previous set of steps.

By default, Samba requires you to configure a password for use when accessing the shares from other computers. (In a later part of this series we'll discuss advanced sharing configuration, like guest shares) This will be, for example, the password you'll use in conjunction with your Ubuntu username when prompted to enter logon credentials after double-clicking a computer icon in the My Network Places or Network window in Windows.

Creating a username for Samba only takes one line of code in Terminal:

  1. Click Applications | Accessories | Terminal.
  2. Type sudo smbpasswd -a username and hit the Enter key.

Replace the word username above with the login or user name of your Ubuntu account, as you can see in the example shown in Figure 2.

If Terminal comes back and says sudo: unable to resolve host <your domain/workgroup name | , you'll need to refer to the next set of steps before moving on.

  1. Type your Ubuntu account password and hit the Enter key.
  2. Type a password for the SMB account and hit the Enter key.
  3. Retype the same password and hit the Enter key.

If you received the unable to resolve host error after executing the smbpasswd command, it's probably because you were fiddling around with settings and you specified a Domain Name in the General tab of the Network Settings. (We discuss changing the Workgroup value later.) Yet you can revert to being domain name-less (so you can continue setting up SMB) by editing the hosts file. Here's exactly how to perform the fix:

  1. Click Applications | Accessories | Terminal.
  2. Type sudo gedit /etc/hosts and hit the Enter key.
  3. Type in your Ubuntu account password and hit the Enter key.

The text editor should pop-up with the hosts file opened.

  1. Delete the Domain Name, including the preceding period, that's just after 127.0.1.1 and your Computer Name; such as Figure 3 shows.
  2. Click the Save button on the text editor's toolbar, close the window, and proceed with the previous set of steps.

Since sharing folders on a network makes your files more vulnerable to access by unauthorized people, letting everyone have the right to share shouldn't be in your computing bill of rights. The Ubuntu developers recognized this thought and made it so only Administrator accounts can, by default, share folders and files among the network, leaving users classified as a Desktop User or Unprivileged out of the loop. However, if you have non-Administrator accounts that you want to be able to share, giving these accounts sharing privileges only takes a simple change in the Users and Groups window:

  1. Click System | Administration | Users and Groups.
  2. On the User Settings window, click the Unlock button, choose an Administrator account, enter the account password, and click the Authenticate button.
  3. On the User Settings window, choose the user you want to give sharing privileges to and click the Properties button.
  4. Choose the User Privileges tab, and select the Share files with the local network checkbox.
  5. Click the OK button to apply changes and close the window.
  6. For changes to take effect, restart your computer.

Changing the Workgroup for Ubuntu

When browsing through the computers on your network, such as from My Network Places in Windows XP or the Network window of Vista or Ubuntu, you'll see that computers are divided into groups. These groups are either a Workgroup (used on small networks) or Domain (used in larger more complex networks) and exist to help control what users have access to on the network.

Since you're probably working with a small network, you are likely using a Workgroup (rather than a Domain) and each computer on the network should be set to the same Workgroup. The default Workgroup value after installing the Samba software on Ubuntu is WORKGROUP. This may be the same value of your Windows PCs; however you should double-check and follow these steps if a change is necessary on your Ubuntu computer:

  1. Click System | Administration | Shared Folders.

If you don't see the Shared Folders shortcut, click Applications | Accessories | Terminal, type shares-admin and hit enter.

  1. On the Shared Folders window, click the Unlock button, enter your account password, and click the Authenticate button.
  2. Select the General Properties tab.
  3. Type in your desired value into the Domain/Workgroup field.
  4. Click the Close button.
  5. For changes to take effect, restart your computer.

You can alternatively change the Domain/Workgroup value by editing the smb.conf file; here's precisely how to:

  1. Click Applications | Accessories | Terminal.
  2. Type sudo gedit /etc/samba/smb.conf and hit the Enter key.
  3. Type in your Ubuntu account password and hit the Enter key.

The text editor should pop-up with the smb file opened.

  1. Change the value that appears after the workgroup =, highlighted in Figure 4.
  2. Click the Save button on the text editor's toolbar and close the window.
  3. For changes to take effect, restart your computer.

After browsing to and selecting a Workgroup from the network browser of your computer, you'll see icons for each computer on the network and in the Workgroup, that's properly configured for sharing. These icons are labeled by what is called the Computer Name of each particular computer. You might also use the Computer Name when manually accessing computers with the UNC path; for example by typing //computername into a Web browser.

The value of your Computer Name for your Ubuntu computer is probably your account username and the word desktop. However you may want something more descriptive, or that fits into any naming convention you already use, so you or others can better distinguish between computers on the network. If so, you can follow these steps to change the Computer Name in Ubuntu:

  1. Click System | Administration | Network.
  2. On the Network Settings window, click the Unlock button, enter your account password, and click the Authenticate button.
  3. Choose the General tab on the Network Settings window.
  4. Change the value for the Host Name field.
  5. On dialog box that appears, click Change Host Name.
  6. For changes to take effect, restart your computer.

Now that you've set up Ubuntu to share with Windows, in the next parts of this series we'll discuss exactly how to share folders and printers in Ubuntu and use remote desktop connections between the two platforms.

Remember you have many resources at your disposal when you run into problems; here are a few you may find useful: Ubuntu Documentation, Ubuntu Forums, and JustLinux Forums.

Eric Geier is an author of many wireless networking and computing books, including Home Networking All-in-One Desk Reference For Dummies (Wiley 2008) and Wi-Fi Hotspots: Setting up Public Wireless Internet Access (Cisco Press 2006).

This article was first published on LinuxPlanet.com.

Share:
Home
Mobile Site | Full Site
Copyright 2017 © QuinStreet Inc. All Rights Reserved