Skip to content

Home

ssh-clean-keys

Simple lines of code to clean invalid hosts from your .known_hosts-file.

ssh-clean-keys () 
{ 
    for host in $1 $(dig +short $1);
    do
        echo "Cleaning $host";
        ssh-keygen -R $host 2>&1 | sed -e 's,^,I,g';
    done
}

How to join multiple .avi or .mpg files

Imagine that you for some reason end up having several files, such as a.movie.avi.001, a.movie.avi.002, and so on. How do you then join them up into one big avi file? The answer is actually pretty simple – cat and mencoder.

Do the following if you don’t have mencoder installed:

# yum install mencoder mplayer

Then:

$ cat a.movie.avi.001 a.movie.avi.002 a.movie.avi.003 > a.movie.avi

That’s pretty much it, but there’s one final step before it’s done.

$ mencoder -forceidx -oac copy -ovc copy a.movie.avi -o a.movie.final.avi

And you’re done. :)

Contributing to Fedora

After having grown so fond of Fedora, I sort of felt that I should start to contribute back to the Open Source community, as I haven’t done that in a while. So I volunteered as a translator for the Norwegian language. Go figure. ;)

And on that note..

Can’t wait!

RHCT/RHCE exam preparation

Right, first off let me start by saying that I can’t tell you the contents of the RHCT/RHCE exam. At the beginning of each exam you have to sign a contract that legally binds you to keep silent about it. I can however tell you the methods I used to prepare myself for the exam.

If you’re wondering what things you should be studying, this list from Red Hat should always be up to date, as far as I know. So this is, or should be, your only reliable source when it comes to finding out exactly what you need to prepare for.

Attending a Red Hat course is brilliant. Even experienced Linux system administrators can learn something new there. I myself attended RH133 (Red Hat Linux System Administration) and RH253 (Red Hat Linux Networking and Security), and there are a lot of things there that will prepare you properly for the exam, IF you pay attention. These courses give you some studymaterial as well, so I used those books for studying also.

I can’t emphasize this enough, there is NOTHING like hands-on training. You can read and read all you want, but unless you experience it first-hand, it just won’t sink in. As far as I know, the operating system that’s most similar to Red Hat Enterprise Linux, is CentOS, which means that you can use that for training (and the test-exams!). How to do this, you ask? Easy. Use VirtualBox, or some other software that’s similar, VMWare, Qemu, Paralell if you’re on a mac. You can install a virtual machine and just play around there. That’s what I did. I set up both a client and a server, and from there I tested everything from NFS, NIS, Samba, DNS, HTTP, Squid, and so on. It really helps, believe me.

The following point is particularly important. Read the exam properly. That’s right. Out of 8 people in total taking the exam on Friday, including myself, one failed right at the start because he wasn’t properly prepared, and another one failed because she didn’t go through the exam task-list properly, thus made a mistake that just couldn’t be reversed. So take your time, go through the list of tasks you are given, and make some mental notes, or even better, scribble them down on the sheet of paper you are given. It helps to systematically cross out the tasks you’ve done, so keep a clear overview of how much left there is to do. And remember to spend your time wisely. If a task seems too difficult, try another easier task, and get back to the more difficult one when you have time. At least that way you’ll get some things completed, rather than getting stuck on that particular problem, and not really gaining anything.

If there’s something you feel confident about, read about it again, and again, and again. You might think you know a lot, or everything, about something, but you don’t. Simple as that. Better to be over-prepared if you ask me.

If this sounds like hard work, you’re damn skippy that it is. RHCE isn’t meant to be simple, but I can tell you that the satisfaction of passing is greater than you think. And if you think “I can’t possibly do this”, you can! I myself knew close to nothing about Red Hat-systems a month ago. So what they say is true, if there’s a will, there’s a way.

Good luck to you future RHCT/RHCE’s!

Passed RHCE!

I’ve intentionally been waiting to write this post, as I’ve not been so sure of what to write. I guess it all depended on the outcome of my RHCE-exam that I had yesterday. The results? Well, see for yourself.

SECTION I:    TROUBLESHOOTING AND SYSTEM MAINTENANCE
RHCE requirements:  completion of compulsory items (50 points)
overall section score of 80 or higher
RHCT requirements:  completion of compulsory items (50 points)

Compulsory Section I score:                        50.0
Non-compulsory Section I score:                    50.0
Overall Section I score:                           100

SECTION II:  INSTALLATION AND CONFIGURATION
RHCE requirements: score of 70 or higher on RHCT components (100 points)
score of 70 or higher on RHCE components (100 points)

RHCT requirement:  score of 70 or higher on RHCT components (100 points)

RHCT components score:                             100.0
RHCE components score:                             100.0

RHCE Certification:                                PASS

I just can’t believe that I aced the test! 100% correct, god! I have to tell you, I never ever thought this was possible, but the countless hours I spent studying and practicing for the test was well worth it. :)

I’ll be posting some tips and tricks concerning the RHCE-exam soon, so stay tuned.

Creating, bridging and using host networking in Fedora 8/9 (VirtualBox)

As I’ve mentioned in previous posts, I’m quite fond of VirtualBox, and thus we write some more about it! A default installation will give every virtual machine you create an ip of 10.0.2.15, but what if you’d like to enable your virtual machines to be able to interact with each other, each of them having their own ip? Here’s where bridging comes into play. As I’m using Fedora 8, this little section is for – that’s right – Fedora 8 (works in Fedora 9 as well). I’ll be assuming that your host-machine is getting its ip from a DHCP-server.

Add the following line to the bottom of /etc/sysconfig/network-scripts/ifcfg-eth0:

BRIDGE=br0

Then create the file /etc/sysconfig/network-scripts/ifcfg-br0, and add the following:

DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes

Once you’ve done that, restart the network:

# service network restart

Now that we have that finished, you can create a virtual ethernet interface for VirtualBox like this:

# VBoxAddIF vbox0 USERNAME br0

Replace USERNAME with the username of the user you’ll be running VirtualBox as (the user michael would have put the username michael there).

Give all users write access to the device used by VirtualBox to communicate with the host network (/dev/net/tun in this case).

# chmod 0666 /dev/net/tun

Now, start VirtualBox and select your virtual machine, then go to Settings.

Then change Attached to to Host Interface, and type vbox0 into the field Interface Name.

And that’s basically it! If you’d like to create another virtual interface for VirtualBox, just run the line above again, only replace vbox0 with vbox1, vbox2, and so on. All depends on how many virtual machines you’re planning on running simultaneously.

Oh, if your virtual machine seems to stop at boot, when trying to get hold of the network information, it might be your firewall that’s causing the problem. So on the host-machine, disabling the firewall might do the trick:

# service iptables stop

Good luck!

Before I start listing some of my favourite Mac OS X-software, let me just say that my Mac OS X 10.5-frenzy is over. :P Some things were just too laggy in Leopard, on my Powerbook 12?, so I decided to go back to Tiger. And with 1.25GB memory on the machine, it’s working with flying colors. Now, on to the software!

  • Quicksilver
  • Allows users to use the keyboard to rapidly perform tasks such as launching applications, manipulating files and data, running scripts or sending e-mail. It is similar to the Mac OS X applications LaunchBar and Butler, but uses a different interaction paradigm. Although it is a complex application, it is centered on a very simple three-panel interface, called the “command window”: the user performs complex tasks using simple, configurable key-combinations. Quicksilver’s icon is based on the alchemical symbol for mercury (quicksilver is another name for mercury).
  • Adium
  • A popular free software instant messaging client for Mac OS X that supports multiple protocols through the libezv (for Bonjour) and the libpurple (all other protocols) libraries. It is written using Mac OS X’s Cocoa API, and it is released under the GNU General Public License, and many other licenses for components that are distributed with Adium.
  • OnyX
  • A popular freeware for Mac OS X developed by French developer Joël Barrière. It is a multifunctional tool for maintenance and optimization, and can control many basic UNIX programs already built into OS X. It can also help set hidden preferences otherwise modifed by using plist editors and the command line.[1] It has become a highly praised utility among many in the Mac community, in part due to its extensive language support and excellent help files.
  • VLC
  • A portable multimedia player, encoder, and streamer supporting many audio and video codecs and file formats as well as DVDs, VCDs, and various streaming protocols. It is able to stream over networks and to transcode multimedia files and save them into various different formats. VLC used to stand for VideoLAN Client, but that meaning is now deprecated.
  • AppCleaner
  • A small application which allows you to completely and properly uninstall unwanted apps. It isn’t, in fact, sufficient to just delete an application. Installing an application distributes many files throughout your System using space of your Hard Drive unnecessarily.
  • SSHKeychain
  • You no longer have to cancel your ssh request because you forgot to load your keys. Because SSHKeychain acts as a gateway between you and the agent, it can automatically add keys when you need them. SSH will just pause for a few seconds, and you’ll be on your way. SSHKeychain integrates with the Apple Keychain. All key passphrases can be stored, and you can use all your keys just by unlocking the Keychain.
  • Safariblock
  • The goal of SafariBlock is to provide a seamless extension to Safari Web Browser that supports ad-blocking. It is by design an imitation of Firefox’s AdBlock extension.

Mac OS X 10.5 (Leopard) on a PowerBook G4 12”

I briefly wrote an entry about how getting VLC to be your default DVD-playing application, and how to get it to start viewing a DVD you’ve inserted automatically. I even mentioned that I had installed Mac OS X 10.5 (Leopard) on my Powerbook. I’ll go into further detail about that. The installation went okay, BUT, it took ages. One and a half hour perhaps, and I was tempted to reboot to see if starting the process all over again would do it good. But one thing did occur to me during the installation – it was 9G with data that was being installed. Not your usual stripped 150MB installation of Debian, eh. So I waited, and waited. And finally it was installed. I actually think my PowerBook was handling Leopard smoother than Tiger. But it’s probably all in my head. The specifications for my Powerbook G4 12?; 1.5Ghz processor, 512MB RAM, 75G disk (just about), you know, a pretty standard Powerbook. I even ordered 1G memory for the Powerbook yesterday, and it’ll hopefully be arriving today, working miracles with my machine. Now, having said that Leopard is working fine so far, the native DVD-playing software isn’t. In fact, by running the application I’m guaranteeing myself a reboot – really. It locks up the PB so bad, waiting ages doesn’t really help. So what I did was that I just uninstalled the software, along with iTunes and some other crap I didn’t need, downloaded VLC and set that as my default DVD playing software. You gotta love VLC. I haven’t really tested heavy applications on the PowerBook, as I use it as a work/media computer. That means having Terminal, SSHKeychain, Safari, Adium and VLC up and going. Working great so far. Now to see how long it lasts. ;)

Mac – Play DVD automatically on insertion in VLC Media Player

So I’ve installed Mac OS X 10.5 on my PowerBook G4 12?, and it’s working quite well so far. Until the native DVD-playing software went haywire that is. Needless to say, I turned to VLC. Now the problem is getting VLC to automatically launch and start playing the DVD when a DVD is inserted. Here’s what you do. Open up the program Script Editor, and place the following in there:

tell application "VLC"
OpenURL "dvdnav:///dev/rdisk1"
play
next
end tell

Save it, and close the application. Now go to System Preferences -> CDs & DVDs and when pressing When you insert a video DVD, select Run script… and just use the applescript you just made. Voila, it works!

Simple directory listing script

<?php

/*
 *   Dili is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   Dili is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with Dili; if not, write to the Free Software
 *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
********************************************************************************
 *  
 * This is the Dili (DIrectory LIsting) script v0.0.1.
 * Place the index.php in the directory you want listed, simple as that. :)
 *  
 * Jorge Barrera Grandon 
 * Atlantiscrew 
 *
 */

$title = basename(dirname(__FILE__)).'/';

        echo '';
        echo '';
        echo '';
        echo ''.$title.'';
        echo '';
        echo '';
        echo '';
        echo 'Directory listing of '.$title.'';

        $dir = opendir(".");

        while(FALSE !== ($file = readdir($dir))) {
            if($file != "." && $file != ".." && $file != "index.php") {
                $myFiles[] = "$file";
            }
        }

        closedir($dir);
        sort($myFiles);
        reset($myFiles);

        foreach($myFiles as $value) {
            if (is_dir($value)) {
                echo '[d] - '.$value.'/';
        } else {
                echo '[f] - '.$value.'';
            }
        }

        echo '';
        echo '';
            echo '';
                echo '';
            echo '';
            echo '';
                echo '';
            echo '';
        echo '';
        echo '';
        echo '';
?>