Archive for May, 2010


Formatting a Disk in Ubuntu 9.10

May 30, 2010

When most people think of formatting a disk, they think it is the process of deleting everything on the disk. Formatting a disk actually involves a little bit more, and it completely replaces the filesystem on the disk.

A side benefit to formatting a disk is making the disk work on different computers. Only certain types of filesystems are supported by each O/S, and formatting a disk with a common filesystem can ensure that it works with these different operating systems. As an example, if you format a USB key with the ext3 filesystem, it won’t work in Windows. If you use the VFAT filesystem, it will work in both Windows and Linux.

Formatting is fairly simple, and you just need to know the location of the device. USB storage devices (such as USB keyring drives and key fobs) tend to be located at /dev/sda1 or /dev/sdb1. Make sure that you have the right device, and then use one of the many mkfs commands to create the relevant filesystem. As an example, to create an ext3 filesystem, use the following command:

foo@bar:~$ sudo mkfs.ext3 /dev/sda1

A range of other mkfs commands can be used to create other filesystems:


Each of these commands is used in the same way.


System Log Files in Ubuntu

May 19, 2010

As a system administrator, the system log files are some of your best friends. If you watch them carefully, you’ll often know in advance when something is wrong with the system, and you’ll be able to resolve most problems before they escalate.

Unfortunately, your ability to pay close attention to the log files dwindles with every server you’re tasked with administering, so administrators often use log-processing software that can be configured to alert them on certain events, or they write their own tools in languages such as Perl and Python.

Logs usually live in /var/log, and after your server runs for a while, you’ll notice there are a lot of increasingly older versions of the log files in that directory, many of them compressed with gzip (ending with the .gz filename extension).

Here are some log files of note:

/var/log/syslog: General system log

/var/log/auth.log: System authentication logs

/var/log/mail.log: System mail logs

/var/log/messages: General log messages

/var/log/dmesg: Kernel ring buffer messages, usually since system boot-up

Your Log Toolbox

When it comes to viewing logs, you should become familiar with a few tools of choice. The tail utility prints, by default, the last ten lines of a file, which makes it a neat tool to get an idea of what’s been happening in a given log file:

$ tail  /var log/syslog

With the -f parameter, tail launches into follow mode, which means it’ll open the file and keep showing you the changes on the screen as they’re happening. If you want to impress your friends with your new system administrator prowess, you can now easily recreate the Hollywood hacker stape: text furiously blazing across the screen.

Also invaluable are zgrep, zcat, and zless, which operate like their analogues that don’t begin with a z, but on gzip-compressed files. For instance, to get a list of lines in all your compressed logs that contain the word “warthog” regardless of case, you would issue the following command:

$  zgrep -i warthog /var/log/*.gz

Your toolbox for dealing with logs will grow with experience and based on your preferences, but to get an idea of what’s already out there, do an apt-cache search for “log files.”


Creating an Unsecured Website in IIS 7.0

May 19, 2010

Users access unsecured Websites by using HTTP. You can create a Website that uses HTTP by completing the following steps:

1. If you’re creating the Website on a new server, ensure that the World Wide Web Publishing Service has been installed and started on the server.

2. If you want the Website to use a new IP address, you must configure the IP address on the server before installing the site.

3. In IIS Manager, double-click the icon for the computer you want to work with, and then right-click Sites. On the shortcut menu, choose Add Website. This displays the Add Website dialog box.

4. In the Website Name textbox, type a descriptive name for the Website, such as Corporate Sales. IIS Manager uses the name you provide to set the name of the new application pool to associate with the site. If you want to use an existing application pool instead of a new application pool, click Select. In the Select Application Pool dialog box, in the Application Pool drop-down list, select the application pool to associate with the site, and then click OK. Note that the .Net Framework version and pipeline mode of a selected application pool are listed on the Properties panel.

5. The Physical Path textbox specifies the physical directory that contains the site’s content. You can configure the physical path by using a local directory path or a shared folder. Keep the following in mind:

* To specify a local directory path for the site, click the Select button to the right of the Physical Path textbox. In the Browse For Folder dialog box, use the choices provided to select a directory for the Website. This folder must be created before you can select it. If necessary, click Make New Folder to create the directory.

* To specify a shared folder for the site, type the desired UNC path in the appropriate textbox, such as \\CentralStorage83\inetpub\sales_site. If you need to use alternate credentials to connect to the remote server specified in the UNC path, click Connect As. In the Connect As dialog box, choose Specific User, and then click Set. In the Set Credentials dialog box, type the name of the user account to use for authentication, type and confirm the account password, and then click OK.

Note: If you don’t specify a username and password, the user’s Windows credentials are authenticated before allowing access. For an anonymous access site, IIS authenticates the credentials  for the IUSR_ServerName account, so this account should have access to the shared folder. Otherwise, the network connection to the folder will fail.

6. The Binding settings identify the Website. To create an unsecured Website, select HTTP as the type and then use the IP Address drop-down list to select an available IP address. Choose (All Assigned) to allow HTTP to respond on all unassigned IP addresses that are configured on the server. Multiple Websites can use the same IP addresses so long as the sites are configured to use different port numbers or host headers.

7. The TCP port for an unsecured Website is assigned automatically as port 80. If necessary, type a new port number in the Port field. Multiple sites can use the same port as long as the sites are configured to use different IP addresses or host headers.

8. If you plan to use host headers for the site, type the host header name in the field provided. On a private network, the host header can be a computer name, such as EngIntranet. On a public network, the host header must be a DNS name, such as The host header name must be unique within IIS.

9. By default, IIS starts the Website immediately so long as the bindings you’ve supplied are unique. If you don’t want to start the site immediately, clear the Start Website Immediately checkbox. In most cases, you’ll want to finish setting the site’s properties before you start the site and make it accessible to users.

By using the IIS Command Line Administration Tool, you can run the Add Site command to add an HTTP site to a server. I’ve added the syntax and usage below. Technically, bindings and physicalPath are optional, but a site won’t work until these parameters are provided. Adding the physical path is what allows IIS to create the root virtual directory and root application for the site.

Adding an HTTP Site Syntax and Usage


appcmd add site /name:Name /id:ID /bindings:http://UrlAndPort


appcmd add site /name: ‘Sales Site’ /id:5 /bindings:

appcmd add site /name ‘Sales Site’ /id:5 /bindings:http://*:8080

appcmd add site /name ‘Sales Site’ /id:5 /bindings:http:/*:8080
/physicalPath: ‘c:\inetpub\mynewsite’