Linux Blog

Apache “Directory index forbidden by Options directive:”

Filed under: Quick Linux Tutorials — TheLinuxBlog.com at 9:29 pm on Friday, June 27, 2008

This is a common problem with the Apache web server. It is considered a security risk to show the directory contents by default. Especially those in the root directory. The way to fix this is pretty simple, you first need to make sure that there are no -Index directives in any of the configuration files. In your httpd configuration directory grep with a line number for Options like so:

grep -n Options *

If you don’t see any -Indexes then its possible there are included files. Check these directories if you know them, if you don’t grep your configuration file for the Includes:

grep -n Include *

If you’re still getting the test page or a permission denied error after removing the directive that disables Indexes then it may be a permissions issue. Apache needs +x access for all users to enable directory listings. Change the permissions and it should work.

On Fedora there is a file called welcome.conf in the conf.d directory. This can be removed and if you have Options All set, then you should be good to go. On other distributions like Slackware it is easier to accomplish. I wouldn’t recommend allowing any sort of directory listing in a production environment but in my development case, where I only allow access to my test server on a per host basis this is not a big problem.

Also, remember to restart the server after making changes.

Hope this helps, if it doesn’t be sure to drop a comment!

Bash Aliases

Filed under: General Linux,Linux Software,Quick Linux Tutorials — TheLinuxBlog.com at 12:23 pm on Wednesday, June 25, 2008

Have you ever wanted to make a command for something that did not exist? Perhaps modify the functionality of a particular application to something more suitable? I know I have. For example, and I know that there is probably a better way to do this, but on certain Linux machines (such as servers), I like to clear the output before exiting. While I can type the command:

clear; exit

this still leaves me with a line at the top of the screen. Some distributions clear this automatically, for those that don’t an alias can be used.The basic principal for a bash alias is easy. You set an alias up and then use that alias instead of the command.
It appears that aliases have precedence over any already existing applications in the path so it becomes handy if you wish to override a command or perform a task before launching a built in command. I’m sure that this option can be changed if needed.

Now you know what aliases are here is how to use an alias to override the exit command in bash.

alias exit=”clear; exit > /dev/null 2> /dev/null”

Aliases with parameters can get tricky, the best workaround I have found is to write a shell script and put it in your local bin directory.

How to Partition Slackware

Filed under: General Linux,Linux Video Tutorials,Quick Linux Tutorials — TheLinuxBlog.com at 12:14 am on Friday, February 1, 2008

I made this quick video on how to partition Slackware 12


How to partition Slackware 12

You might need to turn up the volume. Let me know what you think of this video and if I should continue to make them.

steps are here for reference:

  1. Boot up the Slackware installation disk
  2. Select a keyboard map (if needed)
  3. Log in as root
  4. Use “cfdisk” to get into the disk manager
  5. Create a swap partition in MB double the size of memory. If you have 256 MB of ram, use 512, 128 use 256 etc.
  6. Change the partition type to swap
  7. Create a root partition on the available space with the full disk
  8. Make this partition bootable with the Linux file system type
  9. write the changes to the disk.

This is a very basic setup. I want to make more videos on various subjects if this one picks up. In the line up is a whole Slackware setup tutorial and possibly various other distributions too. I would like to demonstrate other software and technologies.

Drop a comment and let me know what you think!

Checking your battery life from the shell

Filed under: General Linux,Linux Hardware,Quick Linux Tutorials — TheLinuxBlog.com at 8:46 am on Tuesday, December 11, 2007

I’ve often thought to my self “Wouldn’t knowing how much battery life I had be nice.”

Now when a window manager is open, this isn’t a problem. But when your just in a terminal it can be a bit of a problem. If you don’t get the gist of it heres an example, if I’m just in a terminal writing an article, or programming in VIM on battery life. Now I no longer have to execute the following command and guess how much life I have left:

cat /proc/acpi/battery/BAT1/state

I simply run the command:

yacpi

It tells me all kinds of information about my power usage, what the current temperature is, am I plugged in, what CPU governor I’m using. Its a really neat tool. I would recommend for everyone to install it. Worst case scenario it can be used when the system is undergoing maintenance, or if you left your box sitting in the other room and need to check the battery live via SSH. Check out the screenshot:

YACPI Screenshot

To install it it will vary by distribution. I’m sure Debian has it in its XXXX number of packages which means Ubuntu probably has it too. To install on other distributions such as Gentoo or Slackware you’ll need the source. You can acquire the source from here: http://freshmeat.net/redir/yacpi/55486/url_homepage/yacpi
You’ll also need libacpi which can be found here: http://freshmeat.net/projects/libacpi/?branch_id=70062
Make sure you compile libacpi first, or the make will fail for yacpi.

Thats it, once you download the package and install or download and compile the source you’re good to go. Have a good time checking the battery life from the shell. Try doing that in DOS!

« Previous Page