Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Beginning Ubuntu Linux - From Novice To Professional (2006)

.pdf
Скачиваний:
67
Добавлен:
17.08.2013
Размер:
25.54 Mб
Скачать

118

C H A P T E R 8 G E T T I N G E V E R Y T H I N G U P A N D R U N N I N G

3.After the installation has completed, open a GNOME Terminal window (Applications Accessories Terminal) and type sudo nvidia-glx-config enable.

4.Reboot your system.

5.To further configure the Nvidia card once your PC is back up and running, open a GNOME Terminal window and type nvidia-settings. You’ll see a Settings window like the one shown in Figure 8-16.

Figure 8-16. Once the correct driver has been installed, you can configure Nvidia cards by typing nvidia-settings in a GNOME Terminal window.

Testing 3D Capabilities

To test the 3D function of the graphics card, try running a screensaver. If the graphics drivers are correctly installed, the animations should run smoothly and with a high frame rate.

To select the screensaver, click System Preferences, and then click the Screensaver icon. Select an option from the list that is preceded by GL, although you might also try some of the Ant screensavers, such as AntSpotlight.

Click the Preview button to see the screensaver in action. Note that these screensavers are visually very impressive. This is a good chance to show off your new Ubuntu setup to friends and colleagues!

Configuring Bluetooth

Bluetooth is the short-range networking facility that allows various items of hardware, usually those designed for mobile devices, to work with each other wirelessly. You can use Bluetooth for everything from file transfers between a mobile phone and computer to employing a wireless keyboard with your desktop computer.

C H A P T E R 8 G E T T I N G E V E R Y T H I N G U P A N D R U N N I N G

119

For Bluetooth to work, both devices need to have Bluetooth support. Many mobile phones come with Bluetooth nowadays, and an increasing number of notebook computers do, too. It’s also possible to buy very inexpensive Bluetooth dongles that attach to the USB port of your computer.

Bluetooth hardware is automatically recognized under Ubuntu, and the low-level driver software is installed by default. Therefore, all you normally need to do is install the software that provides the Bluetooth functionality you require.

Pairing Bluetooth Devices

When two pieces of Bluetooth-compatible hardware need to communicate on a regular basis, they can pair together. This means that they trust each other, so you don’t need to authorize every attempt at communication between the devices.

Pairing is very simple in practice and works on the principle of a shared personal ID number (PIN). The first Bluetooth device generates the PIN, and then asks the second Bluetooth device to confirm it. Once the user has tapped in the PIN, the devices are paired.

Pairing is easily accomplished under Ubuntu and doesn't require any additional software. As an example, I paired my Ubuntu test PC to a Nokia 6680 mobile phone. It’s easiest to initiate pairing on the phone, which should then autosense the PC’s Bluetooth connection. On the Nokia 6680, I opened the menu and selected Connections Bluetooth. Then I hit the right arrow key to select Paired Devices and selected Options New Paired Device More Devices. This made the phone autosense my Ubuntu PC, which was identified as ubuntu-0. I was then prompted to enter a PIN.

The default PIN for pairing under Ubuntu is 1234, but you can change this by opening a GNOME Terminal window (Applications Accessories Terminal) and typing the following, which will open the PIN configuration file in Gedit:

sudo gedit /etc/bluetooth/pin

In the configuration file, replace 1234 with the PIN you want to use. Then save the file. Next, type the following in the GNOME Terminal window:

sudo /etc/init.d/bluez-utils restart

This will restart Ubuntu’s Bluetooth service to take into account your reconfiguration. Some users report that they are unable to pair their phone with Ubuntu unless they edit

another configuration file. If you find that pairing is refused, type this command:

sudo gedit /etc/bluetooth/hcid.conf

This will open the Bluetooth configuration file in the Gedit text editor. Look for the line that reads as follows:

pin_helper /usr/bin/bluez-pin;

And change it so it reads like this:

pin_helper /usr/bin/bluepin;

Save the file and restart the Bluetooth service:

sudo /etc/init.d/bluez-utils restart

Then try again to pair the device and your PC.

120

C H A P T E R 8 G E T T I N G E V E R Y T H I N G U P A N D R U N N I N G

Transferring Files Between Bluetooth Devices

If you own a Bluetooth-equipped camera phone, you might be used to transferring pictures to your computer using Bluetooth. It’s by far the easiest way of getting pictures off the phone and avoids the need for USB cables or card readers.

In order to transfer files via Bluetooth, you’ll need to install some additional software from the Ubuntu repositories. If you haven’t yet configured the Synaptic Package Manager, see the “Setting Up Online Software Repositories” section earlier in this chapter. Then open Synaptic Package Manager (from the System Administration menu). Click the Search button and enter gnome-bluetooth as a search term. In the list of results, click the check box alongside the entry, and then click Mark for Installation.

You should now find two new entries on the Applications System Tools menu: Bluetooth File Sharing and Bluetooth Manager. I found that Bluetooth Manager didn’t work very well with my phone, so I will ignore it here. It’s designed to allow you to manage Bluetooth connections, and you may like to explore its functions later.

The following instructions detail how to transfer any kind of file to and from your PC using Bluetooth. Once again, I use a Nokia 6680 in the examples, but the instructions should work with any phone, or even any Bluetooth device capable of sending and receiving files.

Note Some phones refuse to transfer files unless the phone and computer are paired, so follow the instructions in the previous section first. Phones like the Nokia 6680 don’t need pairing for file transfer, although each transfer will need to be confirmed each time.

Sending Files to a Ubuntu PC

Follow these steps to send files from a Bluetooth device to your PC:

1.Select Applications System Tools Bluetooth File Sharing. Nothing will appear to have happened but, in fact, a new icon will have been added to the notification area. This indicates your computer is ready for incoming Bluetooth connections.

2.On the Bluetooth device from which you wish to send the file, start the file transfer. On the Nokia 6680, I clicked the file and selected Send Via Bluetooth.

3.When the file transfer is initiated, a dialog box will appear on your computer asking if you wish to accept the file, as shown in Figure 8-17. Click OK. (If the two devices are paired, the file transfer may happen instantly without the confirmation dialog box.) The file will be saved to your /home directory.

C H A P T E R 8 G E T T I N G E V E R Y T H I N G U P A N D R U N N I N G

121

Figure 8-17. If you send files from a Bluetooth device to your PC, you may be asked to authorize receipt.

Sending Files from a Ubuntu PC to Another Device

The easiest way to send files from your PC to a Bluetooth device is to create a desktop shortcut onto which you can drag-and-drop files. Follow these steps to create the shortcut:

1.Right-click the desktop and click Create Launcher.

2.In the Name field, type something like Send file via Bluetooth.

3.In the Command field, type gnome-obex-send.

4.You can also choose to give the new shortcut an appropriate icon. Click the icon button, and then type the following into the Path field:

/usr/share/icons/hicolor/48x48/stock/io/stock_bluetooth.png

5.Click OK.

After you’ve created the icon, you can send files as follows:

1.Drag-and-drop a file onto the launcher (icon) you just created.

2.The Choose Bluetooth Device dialog box appears, as shown in Figure 8-18. Click Refresh to make the computer detect any nearby Bluetooth devices. Remember that your device will need to be set to be “visible” so that other Bluetooth devices can automatically detect it.

3.Select the device to which you want to transfer the file, and then click OK.

4.Check the device to see if the file transfer needs to be authorized. If the devices are paired, the transfer might take place automatically.

122

C H A P T E R 8 G E T T I N G E V E R Y T H I N G U P A N D R U N N I N G

Figure 8-18. Sending files from your Ubuntu PC is easy if you create a desktop shortcut.

Using a Bluetooth Keyboard or Mouse

You may find that your Bluetooth-equipped keyboard or mouse works automatically under Ubuntu. However, if not, you may find the following instructions useful:

1.Open a GNOME Terminal window (Applications Accessories Terminal) and type hcitool scan.

2.Your Bluetooth keyboard or mouse should be identified in the results (ignore any other devices that might appear in the list). If not, make sure it isn’t in sleep mode. You might also have to press a button on the device for it to be made visible.

3.Alongside the entry for the keyboard or mouse will be a MAC address—a series of numbers like 00:12:62:A5:60:F7.

4.In the GNOME Terminal window, type the following: sudo hidd --connect xx:xx:xx:xx:xx:xx

Replace xx:xx:xx:xx:xx:xx with the series of numbers you discovered in the previous step.

5.You should now find that your keyboard or mouse works under Ubuntu. You now need to make sure your mouse or keyboard works every time you boot your computer, so you’ll need to edit the Ubuntu Bluetooth configuration file. Type the following in the GNOME Terminal window to open the configuration file in Gedit:

sudo gedit /etc/default/bluez-utils

Tip

C H A P T E R 8 G E T T I N G E V E R Y T H I N G U P A N D R U N N I N G

123

6.Search for the line that reads HIDD_ENABLED=0 and change it to HIDD_ENABLED=1.

7.Beneath this will be a line that begins HIDD_OPTIONS=. Change this so it reads like this:

HIDD_OPTIONS="--connect xx:xx:xx:xx:xx:xx --server"

Once again, xx:xx:xx:xx:xx:xx is the MAC number you discovered earlier.

8.If you find that the keyboard or mouse doesn’t connect upon reboot, try step 7 again, but this time, change the HIDD_OPTIONS line so it reads like this:

HIDD_OPTIONS="-i xx:xx:xx:xx:xx:xx --server"

Again replacing xx:xx:xx:xx:xx:xx with the MAC address you discovered earlier.

9.Save the file and reboot to see if the mouse or keyboard is working.

If you want to quickly connect a Bluetooth keyboard or mouse to your computer, but don’t need to make it permanent, just open a GNOME Terminal window (Applications Accessories Terminal) and type sudo hidd --search.

Configuring Sound Cards

Generally speaking, your sound card shouldn’t require any additional configuration and should work immediately after you install Ubuntu. The icon for the volume control applet is located at the top right of the Ubuntu desktop, and it offers a quick way to control the master volume.

However, if your sound card offers more than stereo output, such as multiple-speaker surround sound, then it’s necessary to take some simple steps to allow full control of the hardware:

1.Right-click the volume control icon (the one that looks like a speaker) and select Open Volume Control.

2.In the dialog box that appears, click Edit, and then click Preferences.

3.The Volume Control Preferences dialog box appears, as shown in Figure 8-19. Select the sliders that you wish to be visible. For example, on my desktop computer that has 5.1 surround sound, I was able to add a slider for the center and back speakers. On my notebook that has a sound card featuring pseudo-surround sound, I was able to add a control to alter the intensity of the effect.

4.When you’ve finished, click the Close button.

124

C H A P T E R 8 G E T T I N G E V E R Y T H I N G U P A N D R U N N I N G

Figure 8-19. You can add sliders to control all aspects of your sound card’s output.

Summary

In this chapter, you learned how to set up just about every piece of hardware you might have attached to your computer. Additionally, we looked at configuring various software components within your Ubuntu setup that are vital for its correct functioning.

We stepped through getting online with Ubuntu (including joining a wireless network), configuring e-mail, adding a printer, setting up online software repositories, setting up a digital camera, configuring a 3D graphics card, and much more.

In Chapter 9, we move on to look at how you can ensure that your system is secure and protected from hackers.

C H A P T E R 9

■ ■ ■

How to Secure Your Computer

Linux is widely considered to be one of the most secure operating systems around. On a basic level, Linux is built from the ground up to be fundamentally sound, and it forces users to work with security in mind. For instance, it enforces the system of ordinary users who are limited in what they can do, thus making it harder for virus infections to occur.

In addition, Linux contains a firewall that is hard-wired into the kernel. It’s called iptables (www.netfilter.org) and is considered among the best by practically all computer security experts. Not only that, but it can protect your home PC just as well as it can protect the most powerful supercomputer. But, as with many Linux kernel components, iptables is difficult to use. It requires in-depth knowledge of how networks operate and an ability to hack configuration files, both of which are beyond the skills of many ordinary computer users. Fortunately, several programs act as interfaces to iptables and make it simple to operate (or at least as simple as any equivalent Windows-based software firewall, such as Zone Labs’ ZoneAlarm).

Perhaps surprisingly, Ubuntu doesn’t install any firewall configuration program by default. According to the official FAQ (www.ubuntulinux.org/support/documentation/faq), the developers consider Ubuntu to have no need for such a thing. However, configuring the firewall with a program like Firestarter, which we examine later in this chapter, can be done so quickly and with such little effort that there’s no reason not to make use of the Linux firewall.

In this chapter, you’ll learn how to configure the Linux firewall, but first, you’ll spend some time examining more basic security concepts. Following that, we’ll look at some elementary steps that you can take to protect your system.

Windows Security vs. Linux Security

If you’ve switched to Ubuntu from Windows, there’s a very good chance that the security failings of Windows featured in your decision. By any measure, Microsoft’s record on security within its products is appalling. A new and serious security warning appears seemingly on an ongoing basis, and a new and devastating virus makes news headlines with similar frequency (usually described as “a PC virus” rather than what it actually is: a Windows virus).

One argument is that Windows is the target of so many viruses merely because it’s so popular. Although it’s true that some of the underground crackers who write viruses dislike Microsoft, there’s also little doubt that Windows has more than its fair share of security issues.

125

126 C H A P T E R 9 H O W T O S E C U R E Y O U R C O M P U T E R

The situation is certainly getting better but, even so, Microsoft’s latest operating system, Windows XP, provides many good examples of why it’s an easy target. Upon installation, the default user is given root powers. True, a handful of tasks can be performed only by the genuine administrator, but the default user can configure hardware, remove system software, and even wipe every file from the hard disk, if he pleases. Of course, you would never intentionally damage your own system, but computer attackers use various techniques to get you to run malicious software (by pretending it’s a different file, for example) or by simply infecting your computer across the Internet without your knowledge, which is how most worms work.

Viruses and worms also usually take advantage of security holes within Windows software. As just one example, a famous security hole within Outlook Express allowed a program attached to an e-mail message to run when the user simply clicked a particular message to view it. In other words, infecting a Windows machine was as easy as sending someone an e-mail message!

It’s a different story with Linux. Viruses and worms are far rarer than they are on Windows. In fact, the total number of viruses and worms that have been found in the wild infecting Linux systems number far less than 100 (one report published in 2003 put the number at 40, and the number is unlikely to have grown much since then). Compare that to Windows, where according to the Sophos antivirus labs (www.sophos.com), approximately 1,000 new viruses are discovered every month! The Sophos antivirus product now guards against just under 100,000 viruses.

Note The high number of Windows viruses may be due to the quantity of Windows PCs out there. After all, for a virus to spread, it needs computers to infect, and it won’t have trouble finding other Windows computers.

But while I would love to say that security holes are not found on Linux, the sad truth is that they’re a fact of life for users of every operating system. Many so-called rootkits are available, generated by members of underground cracking groups. These are specialized software toolkits that aim to exploit holes within the Linux operating system and its software.

The bottom line is that while writing a virus or worm for Linux is much harder than doing the same thing on Windows, all Linux users should spend time defending their system and never assume that they’re safe.

Root and Ordinary Users

As I’ve mentioned in earlier chapters, Linux makes use of something called the root user account. This is sometimes referred to as the superuser account, and that gives you an idea of its purpose in life: the root user has unrestricted access to all aspects of the system. The root user can delete, modify, or view any file, as well as alter hardware settings.

C H A P T E R 9 H O W T O S E C U R E Y O U R C O M P U T E R

127

Linux systems also have ordinary user accounts, which are limited in what they can do. Such users are limited to saving files in their own directory within the /home directory (although the system is usually configured so that an ordinary user can read files outside the /home directory, too). But an ordinary Ubuntu user cannot delete or modify files other than those that he created or for which he has explicitly been given permission to modify by someone else.

On most Linux systems, it’s possible to type root at the login prompt and, after providing the correct password, actually log in as root and perform system maintenance tasks. Ubuntu is slightly different in that the root account is disabled by default, and users are instead able to borrow superuser powers whenever they’re required. For this to happen, they need to provide their login password. With desktop programs, this is automatic, but at the command prompt, users need to preface commands with sudo.

Although the root account is disabled, most key operating system files “belong” to root, which is to say that only someone with superuser powers can alter them. Ordinary users are simply unable to modify or delete these system files, as shown in Figure 9-1. This is a powerful method of protecting the operating system configuration from accidental or even deliberate damage.

Note Along with the root and ordinary user accounts, there is a third type of Linux account, which is similar to a limited user account, except that it’s used by the system for various tasks. These user accounts are usually invisible to ordinary users and work in the background. For example, the audio subsystem has its own user account that Ubuntu uses to access the audio hardware. The concepts of users and files are discussed in more depth in Chapter 14.

ARE YOU A CRACKER OR A HACKER?

Linux users are often described as hackers. This doesn’t mean they maliciously break into computers or write viruses. It’s simply using the word hacker in its original sense from the 1970s, when it described a computer enthusiast who was interested in exploring the capabilities of computers. Many of the people behind multinational computing corporations started out as hackers. Examples are Steve Wozniak, a cofounder of Apple Computer, and Bill Joy, cofounder of Sun Microsystems.

The word hacker is believed to derive from model train enthusiasts who “hacked” train tracks together as part of their hobby. When computing became popular in the early 1970s, several of these enthusiasts also became interested in computing, and the term was carried across with them.

However, in recent years, the media has subverted the term hacker to apply to an individual who breaks into computer systems. This was based on ignorance, and many true hackers find the comparison extremely offensive. Because of this, the term cracker was invented to clearly define an individual who maliciously attacks computers.

So, don’t worry if an acquaintance describes herself as a Linux hacker, or tells you that she has spent the night “hacking.” Many Linux types use the term as a badge of honor.