Recently, I needed to recover a DSL password that only persisted in an old router (Draytek Vigor 2500/We). Since the web interface only shows the username, I tried the backup feature that dumps the entire configuration to a file that you can download. Unfortunately, this data comes in an encrypted form… which makes an excellent exercise for a student of computer science. Continue reading
Author Archives: tiwoc
Remove items from Ubuntu’s indicator applet
Ubuntu 10.04 (Lucid Lynx) features new panel applets called “indicator applets”. If you want to get rid of some of them, they can be removed by removing the corresponding package(s) using your favourite tool (Synaptic, aptitude, apt-get, …):
- indicator-me provides the menu with your avatar and your availability status
- indicator-messages provides the menu for email/Evolution, social networks/Gwibber etc.
- indicator-session provides the menu with the shutdown/logout button (if uninstalled, this functionality will be provided by the “System” menu)
- indicator-sound provides the sound/audio settings menu
For more information, have a look at the Launchpad page and the Ubuntu Wiki page for the indicator applets.
List of Publications / Bachelor Thesis
I just added a page featuring my (currently quite short) list of publications. It also lists my bachelor thesis which won the 5th prize of CAST e.V. Förderpreis IT-Sicherheit, which probably means that there’s room for improvement
Automated MySQL backup for shared webhosting
What to do if you want to use mysqldump in a shared hosting environment without being able to access the shell (SSH…)? Use a Perl CGI script:
#!/usr/bin/perl -w use strict; use CGI::Carp qw(fatalsToBrowser); print "Content-type: text/plain\nContent-disposition: attachment; filename=\"db_backup.sql\"\n\n"; print qx(mysqldump -uUSERNAME -pPASSWORD DATABASE 2>&1);
Replace USERNAME, PASSWORD and DATABASE with the configuration data for your database and drop the script into your cgi-bin directory. Don’t forget to make it executable (chmod +x) and apply some form of access restrictions! Here’s an Apache .htaccess file which serves well for this purpose: Continue reading
Dell Preboot Authentication: Deleting smartcard associations
Laptops from the new Dell Latitude E series come with an OEM version of Wave Embassy Trust Suite. This software can be used (amongst others) for configuring BIOS and hard disk “passwords” based on smartcard authentication.
This is a nice feature, but what if you try to turn this off again after trying it out? There is just no such option; once configured, the smartcard login can no longer be turned off properly. The FAQ tells us to unset some passwords which just does not work as described, at least when using a hard drive password: The laptop still requires the smartcard before booting.
I wrote to the Wave Systems support and got a valuable hint, which finally worked:
- Open a command line window (right click on the command prompt application and select “run as administrator” when you are running Windows Vista or 7)
- Change to the following directory (cd): C:\Program Files\Wave Systems Corp\Dell Preboot Manager
- Type the following line: PrebootEnrollmentUtil.exe x <SystemPassword>
In step 3, <SystemPassword> needs to be replaced by your system password.
This will delete all credentials in the Credential Vault. Who would have thought of a Windows application providing a command line mode mightier than the graphical counterpart?
ionice: Controlling the Linux I/O scheduler
Linux is quite good at scheduling the CPU time of running programs: Even when a process is running which constantly uses up all processor power, it is still possible to use another (interactive) program nearly as fast as on an idle system. But if a process is doing heavy I/O operations (i.e. backup software), the response times of interactive programs can be heavily increased.
A possible solution for this problem is the command line tool ionice which can be used to control the I/O scheduler. For example, if a backup tool is to be run, running
ionice -c3 COMMAND
will execute COMMAND with the scheduling class “idle” (will only run when no other process needs I/O).
Have a look at the man page for more information.
Clean MySQL backup using mysqldump
If you need to configure a backup of a MySQL database server, you shouldn’t simply copy it’s database files from /var/lib/mysql since they might be inconsistent (due to simultaneous changes). mysqldump is a safe choice for this task. I wrote a simple script for Debian that uses the pre-configured “debian-sys-maint” account and compresses the output:
#!/bin/bash BACKUP_FILENAME=/var/backups/mysql/mysql.dump mysqldump --defaults-extra-file=/etc/mysql/debian.cnf --all-databases --lock-all-tables --result-file=$BACKUP_FILENAME gzip $BACKUP_FILENAME
Please take care that you need to create the output directory (/var/backups/mysql in the above example) first!
If you need more than one revision of the backup, you might want to use “date” to format the filename. Since I run a normal (rdiff-)backup of a big part of the server afterwards, I don’t need this.
java -jar ignores classpath — Workaround
When you want to run a Java class wich needs additional libraries, you usually run java -cp mylib.jar MyClass or you specify the environment variable $CLASSPATH before running the class.
When you have a JAR file you want to run, you usually do this by issuing java -jar myjarfile.jar
If your’re smart, you’ll think: Hey, I want to run a JAR file with some additional library so I issue java -cp mylib.jar -jar myjarfile.jar ! Forget about it, it won’t work. Believe me. Look into the java man page (section “-jar”) if you don’t believe me. I wasted hours on sorting that out. Even setting the $CLASSPATH variable won’t work. Here’s the solution:
- Open the jar file with some ZIP program (JAR = renamed ZIP).
- Open META-INF/MANIFEST.MF in a text editor.
- Copy the path and name of the main class: If you see a line like “Main-Class: some.package.ClassName”, it’s the part after the colon.
- Run this on your command line instead of the command that doesn’t work: java -cp mylib.jar:myjarfile.jar some.package.ClassName
Now you shouldn’t get any more NoClassDefFoundErrors…
Concrete example: If you want to run Lecturnity Player under Linux, just download the .jar, install the Java Media Framework (I used the “Cross-platform Java” version) and run the following command:
java -cp /opt/JMF/lib/jmf.jar:player_30.jar imc.epresenter.player.Manager
This assumes that you put the Java Media Framework to /opt/JMF and you are in the directory where player_30.jar resides.
Strato V-Server/Virtuozzo: Memory usage
This blog runs on a virtual server offered by Strato. They use Virtuozzo for virtualization which has a drawback: If you use top, free or other tools to show the current memory usage, not only your “slice” of the machine but more (all?) of the memory is measured. This doesn’t help much if you try to find out how much of it your own processes use, which is important as you can use only a certain part of the machine’s memory.
I could not find a better way to circumvent this but to sum up the numbers of every single process, listed by ps. Here’s a little shell script that does the job:
#!/bin/bash echo -ne "Allocated virtual memory: " ps auxh | sed 's/ \+/ /g' | cut -d' ' -f 5 | \ php -r '$c=0; while($line=fgets(STDIN)) $c+=intval($line); echo "$c";' echo " kB" echo -ne "Used physical memory: " ps auxh | sed 's/ \+/ /g' | cut -d' ' -f 6 | \ php -r '$c=0; while($line=fgets(STDIN)) $c+=intval($line); echo "$c";' echo " kB"
You need to have the command line version of PHP 5 installed to run this script. The corresponding Debian package is called php5-cli.
Kundenfreundlichkeit vs. Shareholder Value
Gunter Dueck ist Mathematikprofessor und arbeitet als “Distinguished Engineer” bei IBM. Er veröffentlicht regelmäßig (aber nicht täglich…) seine Kolumne “Daily Dueck”, in der er über Wirtschaft und Arbeitsleben philosophiert. Heute schreibt er über “Kunde und Überkunde”. Sehr lesenswert!