Quickzi: How To Block Incoming Access to Port 80

Here is a quick Linux tip to block incoming access to port 80 using iptables.

iptables -A INPUT -j DROP -p tcp --destination-port 80 -i eth0

The code above will drop all tcp packets coming into your Linux computer on device eth0 on port 80.  If your Internet connection runs through a device other than eth0, go ahead and make the adjustment.

To remove the iptables rule use the following code:

iptables -D INPUT -j DROP -p tcp --destination-port 80 -i eth0

For more information on using iptables visit the iptables man page.

Monitor Unix and Linux with Microsoft

Sean Michael Kerner is at Interop in Las Vegas where Microsoft has announced that their new Microsoft System Center Operations Manager allows you to monitor Unix and Linux systems.

Shilmover showed a live demo of Microsoft’s tool actually managing a Red Hat Enterprise Linux Server, SUSE Linux Enterprise Server and a MySQL database server. To be honest I’ve never seen anything like it before –  Microsoft demonstrating how it can manage Linux and Open Source technologies.

Microsoft is finally acknowledging that the open source and Linux/Unix world is slowly becoming the norm.  Instead of sitting back, they are coming up with new business models to adapt.  I suppose this is a good thing, but who really wants to use Windows to manager their Linux and Unix servers?

Read Sean Kerners article here.

How To Enable BCM43xx in Ubuntu 8.04

Here is a question I’ve been seeing pop up over the past few days:

My Broadcom bcm4306 Wireless card wont work in Ubuntu 8.04.  How do I fix it?

The most common reason is simply because Ubuntu did not enable the restricted driver.  If your Ubuntu 8.04 installation did not enable your Broadcom Corporation BCM4306 Wireless LAN Controller, here is how to enable it.

First, you need to make sure the b43-fwcutter package is installed.

sudo apt-get install b43-fwcutter

Next, navigate to System -> Administration -> Hardware Drivers

bcm4306 wireless driver in ubuntu 8.04

You should see your Broadcom 4306 device listed.  Check the box to enable it.

Now your bcm43xx Broadcom Wireless card should be working in Ubuntu 8.04!

Linux Contest with a $25 Amazon Gift Card Giveaway – Week 1

One of our goals is to provide Linux administrators and users alike a place to quickly learn and develop their Linux skills. In keeping with this goal we are starting a Linux contest. Every week we will ask a Linux question, introduce a problem, or offer a challenge. Readers who want to participate must post their answer in the comments section corresponding with the question. At the end of four weeks the person who answers the most questions correctly will win a $25 Amazon Gift card.

So, in short, here is how the contest will work:

  • One question will be posted every week on the Foogazi homepage (Subscribe to the RSS feed to receive updates whenever we post a new question)
  • It is up to YOU to answer the question by posting a comment
  • Comments will not be approved until two days after the question is posted to ensure everyone has a fair chance and to prevent copying.
  • The best answer submitted to the comments after 2 days will be displayed in the main post and a winner will be declared
  • The person who answers the question correctly and most accurately will win that weeks question challenge
  • At the end of the four week challenge, the person who has the most questions answered correctly will win a $25 Amazon gift card
  • In the event of a tie, the winner will be determined based on the time it took to post their answers, with the fastest person being declared the winner
  • Speed is not as important as the quality of the answer!

The idea is to learn through challenges. So let’s get started!

The questions will start simple and increase in difficulty as the weeks go on.

Question 1 : Week 1

From the command line, how do you disable a user from logging in via FTP?

Post your answers in the comments!

Remember, subscribe to the RSS feed to get notified of the answer as well as the next question!

*Wednesday Update*

There have only been a total of 5 submissions since Monday. I am not approving comments until Friday so you still have a chance to submit an answer and win!

*Thursday Update*

If you think you know the answer to the question above, post it in the comments!  The answers will be revealed sometime this weekend and Monday we will have a new question!

*Sunday Update*

I’ve approved all of the comments so you can see everyones answers.  We didn’t have much of a turn out for week 1, so be sure to pass on the word that we’re running a contest.

The best answer from week 1 was submitted by Ben P and John Stevens.

The answer is: echo username >> /etc/ftpusers or "username"

Congratulations to Ben and John.  Check back this week, or subscribe to the rss feed to get the week 2 question!

Wubi Is Just Not Ready

Over the past few weeks prior to the Ubuntu 8.04 “Hardy Heron” release, I was skeptical about Ubuntu fully endorsing and officially supporting Wubi in Ubuntu 8.04. Previously, Ubuntu 7.04 and 7.10 included Wubi, but unofficially. I’ve tested Wubi on a few different computers, and have had varied results. It works sometimes, other times it fails completely. I’ve heard the same stories over and over from multiple Linux users that Wubi either works or doesn’t work at all. The inconsistency of Wubi is what worries me.

Wubi is supposed to be a way for potentially new Linux users to try out Ubuntu without needing to partition a drive, or know anything technical at all, right from the Windows desktop.  A few clicks, and magically, Ubuntu is installed.  However, it’s proven not to be the case for a lot of users.

Originally, I thought Wubi becoming “official” would be great for Ubuntu, and the Linux Desktop in general.  If users can easily install a Linux distribution that “just works”, then the Linux desktop is on the right track to becoming a much more mainstream operating system.  Wubi is an awesome project, don’t get me wrong.  I’m all for users being able to install a Linux distribution without having to bother with partition information, right from their Windows desktop.  Among the many advantages, Wubi helps pull in a new crowd of potential computer users that just may make the switch from Windows to Linux if they see how easy it can be.  However, if these potential users are installing Ubuntu with Wubi and getting errors, how does that make Linux look? Bad.  Buggy.  “Linux doesn’t work!”.  Right?

I’m amazed that Ubuntu has provided Wubi in the Long Term Release with such an inconsistent success rate.  Each new user that tries out installing Ubuntu with Wubi faces the chance of Wubi failing.  It makes Ubuntu, and Linux in general look bad.  Heck, even Mark Shuttleworth himself called out for users to test Wubi before the actual release of Hardy Heron so that developers could fix any last minute issues. Obviously everything wasn’t fixed.  A quick glance at the Ubuntu Wiki for Wubi, shows over twenty known issues. From boot problems, to crashes, to random error messages.  It’s just not ready to be supported officially.

How To Upgrade from Ubuntu 7.10 to Ubuntu 8.04

If you haven’t heard the news already, Ubuntu has released Ubuntu 8.04 “Hardy Heron” for both the Desktop and Server. This is the second Long Term Release of the popular distro.

This release marks some pretty drastic improvements for the fight to bring the Linux desktop to the mainstream audience. Wubi, the Windows based Ubuntu Installer, is an officially supported Ubuntu installer for Windows users that can bring you to the Linux world with a single click. Wubi allows you to install and uninstall Ubuntu as any other Windows application, in a simple and safe way. This is definitely going to get more “everyday” desktop users to try out Linux.

Upgrade from Ubuntu 7.10 to Ubuntu 8.04

If you have an existing installation of Ubuntu, upgrading to the latest 8.04 is very simple. Just open System -> Administration -> Update Manager or from the command line, run sudo update-manager. Check for new updates and simply click on the Upgrade button next to the message that states “New distribution release“.

Read the official how to upgrade from Ubuntu 7.10 to Ubuntu 8.04 here.

To download the new Ubuntu 8.04 “Hardy Heron” release go here.

Getting help with the Linux Command Line

This is a guest post by Taylor Douglass

The command line interface (CLI) is a very powerful part of Linux. Linux beginners undoubtedly agree that at first it can seem a bit daunting and even dangerous. While it is true that there far more Linux commands available than most will ever want or need to know and that some of these commands are capable of wreaking havoc on your system if used incorrectly; it’s reassuring to know that help isn’t far away. While a new Linux user who is Internet savvy might be inclined to run straight to Google when they need help with a particular command or are searching for the command they need, this is not necessary. In fact, most of the time you don’t even need to leave your terminal. How is this possible? Simple, it’s the man command.

Getting Started With Man

Man is short for Manual, and basically means that by using the man command you are accessing the manual for a particular command. Let’s begin by exploring how man is used. Startup a terminal and type “man intro”. This brings up a basic introduction to user commands, and the CLI in general. Once you have finished reading the intro go ahead and exit the manual page by hitting the letter “q”. You should now be back at the command prompt. The next step you will want to take is to read the manual page for the man command itself. This is accomplished by typing “man man“. You may be beginning to see a pattern here. To see the manual for any command simply type “man command” at the prompt. You may also begin to notice a pattern in how the manual pages look. Most manual pages consist of several different sections. Let’s take a look at the sections available for mv command. Type “man mv” into your terminal.

Name
This section shows the command and gives a brief description of the command. In our example we see that the mv command is used to move or rename files.

Synopsis
Here you can find precise information on using the command that you are viewing. This includes all the switches and options available for the command. The first two sections (Name and Synopsis) are meant to be a quick reference for using the command that you are viewing. Further sections dive a little deeper and give you even more information.

Description
The description section breaks down all of the options available and tells you what they do. In our example with mv we can see that using the -i option prompts the user before overwriting any files that are being moved. Also note that we could also use –interactive to do the same thing.

Other sections
Other sections that you might find in the manual pages are author information, bugs, copyright, files, see also, and examples. The two that might be worth mentioning are the See Also and Example sections. See Also gives you a list of other manual pages that may be relevant to the page you are currently viewing, while the Example section gives you a real world example of using the command you are viewing.

Searching For Commands

Let’s say that you want to copy a file but you are not sure what the command for copy is. Perhaps one of the most useful features of the Linux manual pages is the ability to search them. If we look at the manual page for the command man (Again that is “man man” at the command prompt) we can see that one of the options available is -k. What this option does is allow us to search the short description for keywords and display any matches. Back to our example for finding the command to copy files, let’s get to the command prompt and type “man -k copy“. This displays all the commands that have “copy” listed in the description. If you glance through the list of commands that man -k has found you should see “cp(1) -copy files and directories“. That looks like the command we need, but to be sure let’s look at the manual page for that command to be sure. “man cp” brings up the manual page for the command cp. As you can see by looking at the name and synopsis sections, this is indeed the command we need to copy a file.

Man I’m Glad There are Manual Pages

The man command has gotten me out of a jam on more than one occasion. I recommend that if you are just beginning to explore the CLI that you do a quick check in the manual before using any command. As I mentioned before the CLI is very powerful and it’s better to be safe than sorry when using it.

Hands on With Wubi

This is a guest post by Taylor Douglass

From the official Wubi website:

“Wubi is a Ubuntu installer for Windows users that will bring you into the Linux world with a single click. Wubi allows you to install and uninstall Ubuntu as any other application. If you heard about Linux and Ubuntu, if you wanted to try them but you were afraid, Wubi is for you.”

For what Wubi claims to be able to do, I’m somewhat surprised that I haven’t heard more about it. Basically, you can install Ubuntu from Windows and then boot to Linux or Windows without having to do any kind of Grub trickery or anything. Wubi even changes your boot.ini files so that you can choose between booting to Windows or Linux. It’s like having your cake and eating it too!

My first question, and I’m sure I’m not alone here, is how does it work? Wubi works by creating a stand-alone installation inside of a loopmounted device. A loopmounted device is a fancy word for a file that is recognized as a device. So basically Ubuntu thinks that it is running from a Live CD when it is actually running from a hard drive. Some have described Wubi as a virtual machine. This is not the case. No other partitions are created on your hard drive.

So, let’s get down to it. What I intend to do is install Wubi and document my experience along the way. So without further delay, let’s get to work.

Installation of Wubi

The Wubi installation begins by downloading an installer. This is a small file (1.1MB) that is used to setup Wubi on your hard drive. When you first run the Wubi installer it greets you with a few questions such as what hard drive you want to install to, how big you want the installation to be, what desktop environment you want (Ubuntu, Kubuntu, Xubuntu), language, and then a user name and password. I went for a pretty standard installation. 12 GB on my C drive with Ubuntu in English. After that the installer begins downloading the ISO for Ubuntu 8.04 Hardy Heron. Hardy is currently in beta right now, and I have been wanting to try it out, so this is almost a double hands on experience for me. Once everything is downloaded and installed Wubi will ask you if you want to reboot now or do it manually later. I want to reboot now!

After the reboot everything was looking good. I got to choose whether I wanted to boot to Windows or Ubuntu. The new artwork for Hardy Heron came up. The installation started to go as planned. Things were being verified, partitions were being made (not real one’s), and configurations were being configured. And then, fail. The installation never got past 82% complete. It just hung there with a message box that said “Configuring APT – Scanning Mirror”. I gave it about 20 minutes before I rebooted. When I tried to boot back into Ubuntu I got into an error loop. Ubuntu told me that “no root file system is defined” and that I need to correct this, but when I clicked “ok” it just gave me the same error again. I then went back into Windows, removed everything from the C:\Ubuntu\disks folder and tried again. What this does is basically wipe your installation clean. I was hoping that it was just a little stumble, but again the installation got all the way to 82% and hung there with the “Configuring APT – Scanning Mirror” message. This time I got thinking about what this actually meant. I could move my mouse around and drag the dialog box around, so the computer was not locked up. The APT is a repository for different updates and modules. I began to wonder if there was some kind of problem with the connection to one of these repositories so I reached behind my computer and yanked out the network cable. Sure enough the progress bar started moving again, and the installation finished.

How is it?

One of the first things I wanted to know about Wubi was whether or not you got a clean boot every you re-booted. What I mean by that is does everything that you save get reset when you reboot like it does when running a live CD? The Wubi FAQ wasn’t really clear about this. So I changed a few things, installed some different software, installed a different theme, created some documents and rebooted. Sure enough, all of my changes were saved. In fact, I was having trouble finding much of a difference between a normal Linux install and a Wubi install.

One of the first things I noticed about Wubi is that it recognizes all of my hard drives. This doesn’t sound like much of a feat, but I have ran countless different liveCD’s that will not do this. I’m sure that with a little elbow grease I could have got them to, but with a Live CD I don’t really feel that it’s worth it. Anyway, what this means in a nut shell is that you can work on something in Windows, restart your computer, boot to Ubuntu, and continue working on it.

The overall speed of Wubi really impressed me. I just assumed that since Linux wasn’t running as it normally does I would experience an overall system slow down. That was not the case. My littleThink Pad laptop struggles at times to run XP, but with Linux I had no trouble at all. At one point I had Gimp, Blender, 10 terminal windows, Firefox , a few open office documents, and I was playing music. During this I noticed almost no drop in system performance at all. I so “almost no” because there was a little delay withCompiz window effects, nothing that I would call a serious problem though.

The Future of Linux?

I think that Wubi has a lot of potential to put Linux in front of users as a viable desktop operating system. This is something that Live CD’s and dual boots have tried to do and failed. Live CD’s failed because they do not allow the user to save data, changes, files, etc. They also run much slower than a Linux system that is installed. Dual boots didn’t work because it was very difficult for the typical user to setup a dual boot. Setting up a dual boot required the user to do several things that if done incorrectly, or in some cases correctly, would render both operating systems useless. What Linux really needs is to combine the good points of a dual boot and a Live CD, and that is exactly what Wubi has done. Setting up a dual boot with Wubi is completely transparent to the user, anything can be saved, and best of all it runs fast. The average user would not even know the difference between a standard Linux install and a Wubi install.

Creating Custom Linux Commands

This is a guest post by Taylor Douglass

The other day I ran across a script at shell-fu that generates a random quote from their website (here). I thought it would be useful to make this a command that I could execute at any terminal at anytime. Let’s get started.

First of all you are going to need links. If you don’t have links or are not sure if you do or not, fire up a terminal and type the following:

# sudo apt-get install links

Next navigate to your /bin folder and create the file

# sudo touch shell-fu

Make the file readable and executable

# sudo chmod +rx shell-fu

Now edit the file and add the code for retrieving the shell-fu quote (I use nano for this)

# sudo nano shell-fu
# links -dump "http://www.shell-fu.org/lister.php?random" | grep -A 100 -- ----
^O (writes the file from nano)
^X (exits nano)

You now have a custom command named “shell-fu” that you can type from anywhere and retrieve a random shell-fu quote.