Backdooring KnoppixRemastering Knoppix (see Knoppix Hacks #94) remains pretty uneasy and time consuming. Here is a way to backdoor your Knoppix so that you'll be able to add a few new functionnalities (eg : add a script, aliases, even add new programs) in a snapshot... This hack won't keep you from remastering : it will help you in remastering a smartest way...
Contributed by:
Endrazine
[07/08/05 | Discuss (0) | Link to this hack]

By allowing the execution of a few generic scripts outside the big 700 Mo KNOPPIX file, one can actually "Backdoor Knoppix" in order to fasten up further modifications. I used this hack to build a Knoppix Remaster I could publish, and then tuned to my own needs so that I could automatically mount a remote drive via samba : this way, I kept my remote disk IP private (for obvious security reasons) and did not have to rebuild the whole Remaster. This trick can also be used to perform more complex tasks, like adding new scripts, modifying aliases or even adding new apps to your remaster in no time.

The first thing you need to do is backdooring this big annoying 700++ Mo compressed file so that an external script located at the cdrom root (and therefore *NOT COMPRESSED*, ie editable) will be launched at boot time. You may think in backdooring your .profile or .bashrc files... I choosed to modify my /etc/skel/.fluxbox/startup instead because it will only be run once (as opposite to the ~/.bashrc that will be used any time a new shell is started).

If you use Kde instead, you can do the same with /etc/skel/.kde/Autostart/Presentation.sh. Icewm lovers will need to edit /etc/skel/.icewm/startup, etc...

As you can see, the first trick allows the execution of /cdrom/initscript1.sh when launching fluxbox. The second one copies /cdrom/initscript2.sh to /home/knoppix/ and runs it.

Now you can simply finish up your remastering process (see hack #94) to generate the backdoored 700++ Mo KNOPPIX file. When you're done, don't forget to create /cdrom/initscript1.sh and /cdrom/initscript2.sh to customize your Remaster. The next time you'll want to modify your distribution, simply edit one of those two scripts to have your modifications automatically applied. Here is my initscript1.sh :

I found that one very usefull when a friend of mine asked me for a version of my remaster adapted to his aliases habbits :) Now, let's do something a little bit harder : allow users to mount a remote disk via samba with a simple command (change the IPs and hostnames to fit your needs. Those are intranet IPs, but internet IPs will work fine too) :

What the script does is looking for a file named .testflag in /home/knoppix/foo/ if found, then the partition is already mounted : print a nice warning message. Otherwise : prompt for a login, mount the partition to /home/knoppix/foo/ and create a .testflag there.

Conclusion : This trick can be used to quickly modify a pre-remastered Knoppix, but deep changes like changing the windows manager or removing programs via apt-get can't be done that way :( If you want to add a new app to your Knoppix, you can link to a bin placed in /cdrom/some.prog or even copy it if it's small enougth.