Friday, July 26, 2013

Installing Kazam screencaster on Debian Wheezy from CrunchBang repos

When I went looking for a cool screen recording app for Linux that had native support for WebM, I didn't find anything in the Debian repositories that fit my criteria. Gnome 3 has a very handy built-in screen recorder that supports WebM, but I don't know of an easy way to use it outside of Gnome. However, there where a few cool-looking options available for Ubuntu, so I decided to see if I could find a way to install one of them on Debian. Kazam looked pretty cool, so I decided to give it a try. A little searching found that it is available for CrunchBang, a distribution derived from Debian, and the packages are apparently compatible.

However, I did it slightly different from how it was described as I didn't want to go installing third-party packages willy-nilly or by accident. I could have just installed kazam and then removed (or commented out) the CrunchBang repository, but then it wouldn't get updates. So what I did was to use apt-pinning to tell the package manager that I don't want any CrunchBang packages installed unless I explicitly install them (or they are pulled in as dependencies of something I explicitly install).

To do this, I first added:

deb http://packages.crunchbang.org/waldorf waldorf main

to my /etc/apt/sources.list with a comment to explain what it is doing there. Next, I added the CrunchBang key with:

wget -O - http://packages.crunchbang.org/statler-dev/crunchbang.key | sudo apt-key add -

Now, to set my preferences, I created /etc/apt/preferences like so:

Package: *
Pin: release n=wheezy
Pin-Priority: 900

Package: *
Pin: release n=waldorf
Pin-Priority: -10


Setting Pin-Priority less than zero is what indicates I don't want packages installed from this repository unless specifically requested. Note that this also means that it will not be upgraded by the usual commands, you must use the command you originally used to install it, but it will be possible to upgrade it with a single command without updating any configuration files again.

Now, I update the package list and explicitly install kazam from CrunchBang Waldorf (Waldorf is the CrunchBang release corresponding to Debian Wheezy):

aptitude update
aptitude -t waldorf install kazam


Now you should have Kazam available to record your own screencasts. All of the options are right there when you open it, to select video and audio sources, codec (VP8/WebM or H264/MP4), framerate, use a countdown timer, capture the mouse (or not), or select a region of the screen to record.

Kazam on Debian (KDE 4)

Note that all of the above commands (including editing files) need to be done as root, except for wget. Also, the line starting with wget uses sudo to run the apt-key command, so you need to be in the sudo group or else run the whole thing as root without using sudo.

Thursday, July 25, 2013

Installing the Tor Browser Bundle for all users on Linux

The Tor Browser Bundle provides a great way to browse the web anonymously through the Tor network. It is super simple to use and in addition to providing anonymity by routing your connection through multiple computers on the network it also blocks a lot of potential data leaks that could reveal your identity. It includes a patched version of Firefox with the HTTPS Everywhere and NoScript extensions.

Now the Tor Browser Bundle is intended to run without installation, even from a flash drive, but what if you want to install the Tor Browser Bundle to be available for all users on the system and show up in their application menus? I often install the official Mozilla build of Firefox and Thunderbird in /usr/local/bin, owned by my primary user (as described here). That way, all users on the system can use the applications and automatic updates work for my user, which updates the application for everyone. However, this approach will not work for the Tor Browser Bundle as it needs to be owned by the user to work properly. It may be possible to get a single installation to work globally by adjusting permissions (although I'm not certain if this might still introduce a security flaw), but the way I went was to configure the system to install it for all new users automatically.

First, put the Tor Browser Bundle directory in /etc/skel. The contents of this directory are automatically copied to each new user's home directory when it is created. Of course, you will have to do this manually for existing users (or perhaps write a script to do it, if you have a lot of users already set up). Next, create the file /etc/skel/.local/share/applications/torbrowser.desktop with these contents:

[Desktop Entry]
Type=Application
Name=Tor Browser
GenericName=Anonymous Web Browser
Exec=./tor-browser_en-US/start-tor-browser %u
Icon=/usr/local/share/icons/torbrowser128.png
Comment=Browse the Web Anonymously
Terminal=false
X-MultipleArgs=false
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;
StartupWMClass=Firefox-bin
StartupNotify=true


Now copy /etc/skel/tor-browser_en-US/App/Firefox/icons/mozicon128.png  to /usr/local/share/icons/torbrowser128.png. Each new user will get their own copy of the Tor Browser Bundle in their home directory, with a launch icon in the applications menu.

 Tor Browser on the Gnome 3 menu

 Tor Browser on the KDE 4 menu

Tor Browser running on KDE 4

Note that you will have to adjust these directions if your locale is not en-US. As a final caveat, browsing through Tor is slower due to being routed through multiple computers and popular plugins like Flash are disabled for security reasons. But this is the best way to browse the web with a reasonable degree of anonymity.

Wednesday, July 24, 2013

Installing official Mozilla builds of Firefox and Thunderbird on Debian

The Debian GNU/Linux distribution includes their own versions of Firefox and Thunderbird, rebranded as Iceweasel and Icedove, which are maintained with security updates for the life of the release. However, some people prefer to use the official Mozilla releases to get the most up-to-date versions. They come in a simple archive file that you can unpack and run right from your home directory, but what if you want to install them system-wide and have them included in the applications menu? Here is how I do it.

First, download the appropriate tarball for your system. The 32-bit builds are easy enough to find (see links above), but if you want to get a 64-bit build they can be found at https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US and https://download.mozilla.org/?product=thunderbird-latest&os=linux64&lang=en-US (note the locale at the end). Simply place the unpacked directories in /usr/local/bin.

The easiest way to keep Firefox and Thunderbird up-to-date is to use the built-in automatic update feature. In order for this to work, Firefox and Thunderbird need to be owned by a user who will actually run them on a regular basis. In my case, they are owned by my user account. Other users who have an account on my machine can use them, but all of the updates get installed by my user. You can just chown -R user /usr/local/bin/firefox, etc.

Now we just need to get them put into the applications menus. For this, we just need to put .desktop files in /usr/local/share/applications.

firefox.desktop should look something like:

[Desktop Entry]
Type=Application
Name=Firefox
GenericName=Web Browser
Exec=/usr/local/bin/firefox/firefox %u
Icon=/usr/local/bin/firefox/browser/icons/mozicon128.png
Comment=Browse the World Wide Web
Terminal=false
X-MultipleArgs=false
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;
StartupWMClass=Firefox-bin
StartupNotify=true


thunderbird.desktop should look something like:

[Desktop Entry]
Type=Application
Name=Thunderbird
GenericName=Mail Client
Exec=/usr/local/bin/thunderbird/thunderbird %u
Icon=/usr/local/bin/thunderbird/chrome/icons/default/default256.png
Comment=Read/Write Mail/News with Thunderbird
Terminal=false
X-MultipleArgs=false
Categories=Network;Email;News;GTK;
MimeType=message/rfc822;x-scheme-handler/mailto;
StartupWMClass=thunderbird-bin
StartupNotify=true


For KDE 4, you may need to run kbuildsycoca4 to update the menus. Now you should see the official builds of Firefox and Thunderbird in the applications menus.

 Firefox icon on Gnome 3 menu on Debian Wheezy

Firefox and Thunderbird icons on KDE 4 menu on Debian Wheezy

Update: I now have a video on DailyMotion demonstrating these steps.