Search This Blog

Saturday, December 3, 2011

How SWAT Makes Samba Simpler - PART3


SWAT, Samba's web based configuration tool enables you configure your smb.conf file without you needing to remember all the formatting. Each SWAT screen is actually a form that covers a separate section of the smb.conf file into which you fill in the desired parameters. For ease of use, each parameter box has its own online help. Figure 10-1 shows the main SWAT login screen.

Figure 10-1 Samba SWAT Main Menu

Swat-main.gif

Basic SWAT Setup

You must always remember that SWAT edits the smb.conf file but also strips out any comments you may have manually entered into it beforehand. The original Samba smb.conf file has many worthwhile comments in it, you should save a copy as a reference before proceeding with SWAT. For example, you could save the original file with the name /etc/samba/smb.conf.original as in:
[root@bigboy tmp]# cp /etc/samba/smb.conf /etc/samba/smb.conf.original
As you can see, using SWAT requires some understanding of the smb.conf file parameters because it eliminates these comments. Become familiar with the most important options in this file before proceeding with SWAT.
SWAT doesn't encrypt your login password. Because this could be a security concern in a corporate environment you might want to create a Samba administrator user that has no root privileges or only enable SWAT access from the GUI console or localhost.
The enabling and disabling, starting and stopping of SWAT is controlled by xinetd, which is covered in Chapter 16, "Telnet, TFTP, and xinetd", via a configuration file named /etc/xinetd.d/swat. Here is a sample:
service swat
{

   port            = 901
   socket_type     = stream
   protocol        = tcp
   wait            = no
   user            = root
   server          = /usr/sbin/swat
   log_on_failure  += USERID
   disable         = no
   only_from       = localhost

}
The file's formatting is fairly easy to understand, especially as there are only two entries of interest.
  • The disable parameter must be set to no to accept connections. This can automatically be switched between yes and no as we will see later.
  • The default configuration only allows SWAT web access from the VGA console only as user root on port 901 with the Linux root password. This means you'll have to enter "http://127.0.0.1:901" in your browser to get the login screen.
You can make SWAT accessible from other servers by adding IP address entries to the only_from parameter of the SWAT configuration file. Here's an example of an entry to allow connections only from 192.168.1.3 and localhost. Notice that there are no commas between the entries.
only_from = localhost 192.168.1.3
Therefore in this case you can also configure Samba on your Linux server bigboy IP with address 192.168.1.100 from PC 192.168.1.3 using the URL http://192.168.1.100:901.
Remember that most firewalls don't allow TCP port 901 through their filters. You may have to adjust your rules for this traffic to pass.

Controlling SWAT

As with all xinetd-controlled applications, the chkconfig command automatically modifies the disable field accordingly in the configuration file and activates the change.
Before SWAT can be used, the xinetd program which controls it must be activated in advance. You can start/stop/restart xinetd after boot time using the xinetd initialization script as in the examples below:
[root@bigboy tmp]# service xinetd start
[root@bigboy tmp]# service xinetd stop
[root@bigboy tmp]# service xinetd restart
Just like most Linux systems applications, you can configure xinetd to start at boot time using the chkconfig command:
[root@bigboy tmp]# chkconfig xinetd on
To activate SWAT use:
[root@bigboy tmp] chkconfig swat on
To deactivate SWAT use:
[root@bigboy tmp] chkconfig swat off

Friday, December 2, 2011

How to Disable Windows Startup Programs

You can speed up your PC's boot time by cutting out startup items in Windows.

When you start your computer, Windows isn't the only program that loads. For instance, you may have noticed icons in the notification area (also known as the system tray) in the far-right portion of the taskbar. These icons often represent programs that start when the system starts. You also may have seen certain programs, such as software for syncing your phone or MP3 player, launching themselves along with Windows. Additionally, some applications begin running silently in the background every time you boot the PC.
All of these automatically opening programs consume system memory, and can drag down performance. Fortunately, managing startup programs isn't difficult; by taking a few steps, you can find out what is running on your computer and disable the items you don't need.

Method 1: Configure a Program Directly

If you've noticed a program starting automatically, and you want the behavior to stop, sometimes the easiest solution is to explore the program's settings directly.
1. Open the program.
2. Find the settings panel. Typically it will be available under a menu labeled Settings, Preferences, Options, or Tools.
3. Find the option to disable the program from running at startup. The language for this type of option varies, but it should be easy to find if it exists.
When you restart the computer, the program will no longer launch. You'll still be able to start it manually, so don't be deterred if the application asks you if you are sure you want to disable its automatic startup.

Method 2: Use the System Configuration Utility (MSConfig)

You can use msconfig.exe to change Windows' startup items.You can use msconfig.exe to change Windows' startup items.The System Configuration Utility--also called MSConfig--is a useful tool for understanding and controlling startup programs. Microsoft intends MSConfig to act primarily as a troubleshooting tool, but its simple and powerful interface makes it a good option for startup management as well.
1. Open the Start menu and type msconfig into the Search box.
2. Click the msconfig search result. The utility will open in a new window.
3. Click the Startup tab. You'll see a list of programs that start when your computer starts.
4. To stop a program from automatically launching when you boot the PC, uncheck the box next to its entry.
5. When you are finished deselecting startup items, click OK. If you made any changes, you'll be prompted to restart the computer. You don't have to restart it immediately, but the changes won't take effect until you do.
When you restart the computer, MSConfig will alert you to the changes. In the window that pops up, check the box next to Don't show this message or launch the System Configuration Utility when Windows starts, and click OK to prevent future alerts. You can always return to MSConfig to reverse the changes or make additional tweaks.

Warning

Use caution when disabling items in MSConfig. Many entries have names that aren't self-explanatory. Research each entry before unchecking its box; use the Web to search for the name of the entry, and to get an idea of its function. Without doing your homework, you could end up disabling an important application such as your antivirus program.

Speed Up Windows on What Should be a Fast PC

A number of factors could be slowing down a PC. Let's look at some of the common ones, starting with the issues that are the easiest to detect and to fix.
Defrag the Hard Drive
I'll be honest; it's been at least a decade since I've seen empirical evidence proving that afragmented hard drive slows a PC. But a lot of people insist that it does, and defragging certainly won't hurt. To defrag your hard drive:
  1. Click Start and select Computer or My Computer.
  2. Right-click your C: drive and selectProperties.
  3. Click the Tools tab, then the Defragment now button.
Check For Malware
A malicious program working in the background could slow down your PC while also doing more serious damage. If your PC is infected, chances are that your existing antivirus program is compromised. Try something else. I recommend using the free version of either SUPERAntiSpyware orMalwarebytes' Anti-Malware. Or the AVG Rescue CD, which scans in a non-Windows--and therefore non-infected--environment.

Remove Hard-to-Kill Malware

Are you sure the problem is malware? People often jump to that conclusion when there's something wrong with their PC, and in my experience that conclusion is more often wrong than right. There's a lot of malicious code in this world, but there's even more code that's merely incompetent. There's also a fair amount of worn-out hardware.
On the other hand, if you're experiencing any of the following symptoms, you quite likely have malware:
  • Your security software doesn't work properly, or refuses to update.
  • Common programs for configuring and repairing Windows, such as MSCONFIG and System Restore, don't work.
  • Messages from a program you never installed pop up and tell you that your computer is infected, your hard drive is dying, or you have some other serious problem. (See Watch Out for Rogues for more on this issue.)
  • Your browser's home page keeps changing to something you don't want, and/or your search results aren't what they should be.
  • Your computer slows down sometimes for no apparent reason. (This may not be malware. See Very Slow PC for more on this.)
But what if you've got one or more of these symptoms, yet nothing in your battery of malware-fighting programs finds something evil?
The solution is to use a Linux-based malware-fighting program that boots off a flash drive or CD-ROM. By working outside of Windows, and outside the hard drive's boot sector, these programs can better get around the malware's defenses.
I'm going to recommend two of them, both of which can boot off flash drives or CDs. They're AVG Rescue CD and Dr.Web LiveCD or LiveUSB. If one doesn't do the trick, try the other.

Why is Taskhost Consuming So Much of My CPU?

Like the title character from Woody Allen's Zelig--who changes his political beliefs, ethnicity, and even his race to match those of the people around him--Taskhost.exe can become pretty much what any dynamic link library (.dll) file wants it to be. Libraries can only run through an .exe program file, and taskhost provides that service. This is why you'll often see multiple instances of taskhost running at the same time.
But this also means that if Taskhost appears to be hogging resources, some other file is really to blame. The hard part is tracking down and identifying just what .dll is the culprit.
I was unable to artificially reproduce this condition while working on this article. The screen captures below, therefore, show only a well-behaved taskhost.exe.
To see what taskhost (and other processes) are doing, right-click the taskbar and select Task Manager or Start Task Manager. Click the Processes tab. Click the Image Name column header to alphabetize the processes so you can easily find all of your currently-running taskhost.exe processes.
If you see a taskhost process with a large CPU number, scan for malware. Remember that if your PC really is infected, your regular antivirus program is quite likely compromised. So get a second opinion from one or more on-demand malware scanners.
If malware doesn't turn up, download and run Windows Sysinternals Process Explorer (you don't have to install it). Once loaded, you can find and point to the hoggish instance of taskhost.exe. To see what .dlls are using it, select View, then Show Lower Pane. Press CTRL-d to make sure you're viewing .dlls and not handles.
Hopefully, your bloated taskhost process won't be using as many .dlls as my well-behaved one.