jump to navigation

SSH Tunnel + SOCKS Proxy Forwarding = Secure Browsing December 8, 2006

Posted by Carthik in applications, commands, guides, servers, ubuntu.
221 comments

When you are at the coffee shop, or at a conference, and you are not sure that you want to send all your data over the wi-fi network in plaintext, you want a secure tunnel to browse. This happened to me recently and I stumbled across a neat feature of openssh (the ssh client on everyone’s computer). The wonders of ssh never cease to amaze me!

You can use the “-D” flag of openssh to create a SOCKS proxy.

The command first:
$ssh -D 9999 username@ip-address-of-ssh-server

This of course connects you to the server specified by “ip-address-of-ssh-server”. Needless to say, you (username) must have an ssh account on the server. In addition, this will create a SOCKS proxy on port “9999” of your computer. This is a tunnel to the server. Now all you have to do is set the preference in Firefox to use a SOCKS proxy. The proxy is, of course, “localhost”, with the port 9999.

Now when you browse, all the connections you make to websites will seem to originate from the server to which you SSH-ed. In addition, all outgoing and incoming data for the browsing session will be encrypted since it passes through the SSH connection.

Other applications (like email clients) may also support SOCKS proxies. If any of them, you can look into using proxychains(there’s an Ubuntu package).

You can misuse this technology to circumvent paranoid browsing firewalls, even to pretend you are wherever your ssh server is located – so you can work around country-based blocks etc. I use it for the very unromantic reason that I don’t want some aspiring cracker to sneak up on me when I am in public.

Updates:

Share Music in a Network using Avahi (DAAP) September 22, 2006

Posted by Carthik in applications, guides, music, packages, ubuntu.
40 comments

Okay, so I have a desktop with around 50 Gigs of music. I also have a laptop on which I work most of the time, from various places in and around the house. I did not want to (and don’t have the space to) copy the songs onto the Laptop. So I went looking for a simple way to share my music over the Network.

I found that rhythmbox supports DAAP, the same technology that Apple uses with iTunes to enable sharing.

To enable sharing, install the avahi daemon on the desktop using:
$sudo apt-get install avahi-daemon

Now, in Rhythmbox, go to Edit->Preferences->Sharing(which is a tab) and select “Share my music”.

Avahi is the name of the project that brings DAAP (aka rendezvous or zeroconf) to Linux.

You’re all set! Now when you use Rhtyhmbox on the laptop, or any other system in your network, the music collection on the desktop should appear when you start it up in the “Source” pane on the left! Og’s post was one of the many pages I hit when I was searching for a solution. He even has a screenshot showing how the shared directory shows up.

If you want to share music using Banshee, install the banshee-daap package which provides a plugin for DAAP music sharing.

The only caveat is, even when you use this, Rhythmbox has to be running on your desktop for the files to show up elsewhere. If that bothers you, then see how Tangerine can help you. From the website, we get the following description:

Tangerine is an application that allows you to publish music over the local network, using DAAP. It runs on both Linux and Windows. There are several clients that you can then use to connect to it, such as Apple’s iTunes, Banshee, and Rhythmbox.

Music files can be specified either by a directory, or can be automatically discovered using Beagle or Google Desktop. Recently you can also specify which music player you use and share the songs in it’s collection. For typical configurations, a graphical tool is included (see below).

As far as I know, the stable version of Amarok, my favorite music manager, does not have any support for DAAP, either as a server(for the desktop) or as a client(for other computers to access shared stuff).

Send Email from Nautilus using Thunderbird September 15, 2006

Posted by Carthik in applications, guides, ubuntu.
16 comments

Right clicking on a file on your desktop, or from anywhere in nautilus gives you a “Send To…” option. This enables you to send the file via email using Evolution.

If you use Thunderbird as your mail app, then you certainly want the file to be sent using Thunderbird, but making this change is not so easy. Changing the default email reader in System -> Preferences -> Preferred Applications to Thunderbird should fix this, but since we don’t yet live in an ideal world, it doesn’t.

It looks like nautilus’ preference for Evolution as the mail client to use for the right-click-send-to comes hard-coded in the nautilus send-to plugin, and this plugin is installed on your Ubuntu computer. This nautilus send-to bug has already been noted.

To choose Thunderbird as the app to be used for “Send to…” you will need to use the instructions at Thunderbird support for nautilus send-to.

As a bonus, here’s the page listing all of Thunderbird’s command line options – for when you want to send a file from a command prompt.

(Though I had to solve the above problem with Thunderbird recently for a friend, I am a recent sylpheed-claws-gtk convert. It is absolutely the fastest and best email client I have come across till date.)

Normalize the Gain (Playback Volume) of your MP3s September 11, 2006

Posted by Carthik in applications, commands, guides, packages, ubuntu.
50 comments

I confess to the grave sin of storing part of my music collection in the mp3 format – mostly music I have had around for ages. There, now that that is out of the way, let’s move on to making that collection friendlier.

I have the habit of going to sleep while listening to a little light music. Some of the songs in my collection would sound louder than the others. So when I have a couple of classical music tracks lined up with Paul McCartney and Guns ‘N Roses, I sometimes get jolted awake by the difference in the playback volume. So off I went looking for solutions.

My main concerns when I started my research were:

  1. My mp3s should not be irretrievably changed into something I end up hating
  2. I did not want all songs sounding as loud as the loudest song
  3. The algorithm or method used should be free of the application used for music playback

Then came the choices. In the end it all came down to two apps: Normalize and mp3gain. Now how do I decide which one’s the one for me without learning DSP? Simple, search some more.

Fortunately, besides the websites for the applications, I ran into this thread at jwz’s livejournal. Thank god for geeks-who-start-nightclubs and their friends! I also followed most of the replaygain technical outline, since mp3gain is an implementation of the replaygain idea.

Normalize is simple, perhaps a little too simple.

mp3gain works by figuring out how loud the music actually sounds to the human ear, and then figuring out how much positive or negative gain to apply to the mp3 file to “fix” it. I was happy to note that it does not use the peak volume in a file as a benchmark for normalization. It applies changes by modifying the mp3 file in some fashion, but I read that the change is reversible since mp3gain writes some tags (not ID3 tags) to the mp3s for possible later undoing. This fact also means that one you use mp3gain on a file, if you try doing it again, it takes a lot less time – almost no time. So in the future if I add files to the collection, and I don’t remember what files I added, I can run mp3gain on the entire collection, and it will complete much faster than the first time.

To cut to the chase, I decided to go with mp3gain. I installed the mp3gain package (using $sudo apt-get install mp3gain), and set out to normalize my entire music collection. (For those of you who also have .oggs, check out vorbisgain).

Edit: for an alternative command, with explanation, and a way to use album-gain for songs from albums, visit porges
The following command, executed from the directory where I store my music normalized all the files in my collection:
$find . -type f -iname '*.mp3' -print0 | xargs -0 mp3gain -r -k

What it does is, it finds all files (type -f) in the present directory (.) with a name that ends in “.mp3” and creates a list of the same. The output of this find command is then piped to the mp3gain program. The options that I ended up using for mp3gain, -r and -k dictate that the calculated track gain will be applied automatically to normalize the volume, and that files should be protected against “clipping” by lowering the applied gain if the required gain seems likely to clip the sound. Concoct your own recipe by referring to the man page for mp3gain.

After around 16 hours of processing on my old PIII desktop, my massive 50 GB music collection now agrees on what is an acceptable volume. Needless to say, I sleep in peace.

Lifehacker Gets on the Bandwagon August 24, 2006

Posted by Carthik in applications, commentary, ubuntu.
17 comments

Lifehacker has a post describing the top 10 apps for Ubuntu. I have issues with the first one on the list, but I tend to avoid controversy and will say no more than that sometimes, getting things done yourself is a lot more fun, and informative. So it is that I have never used Automatix or EasyUbuntu, but instead just maintain a list of packages I like to install and install them myselves. Some of the settings I modify regularly are also modified manually. Why?, because fewer things go wrong real bad when a person attends to making the changes, and you change or deviate from the “base” system (which works admirably well) no more than you need to, and every person needs different things. I have known people without DVD drives adding the ability to decrypt DVDs – how that would be useful beats my mind, but the reason?, “Well, I just used Automatix, and it was an option, so there!” This is not meant to disparage the tool in any way, but please do choose to get your hands dirty, learn, and live fully 🙂 There is nothing either of these tools does that is not easy to figure out on one’s own. In any case, it is easier to figure out than figuring out how to enable support to play some wierd (wicked?) codecs in Windows’ Media Player (from what I remember).

I also don’t have (or haven’t done) 8 of the 10 things that are on the LifeHacker list. I haven’t, for sure, had to install Firefox – it’s already installed, LifeHacker!! Also, I prefer mplayer over VLC, and so on… So while you have to take the “Top 10 Apps for Ubuntu” title, and the list of software/steps recommended with a grain of salt, it is always good to see Ubuntu catching on, and being mentioned in popular online media.

Evolution for Windows- an Outlook Replacement July 21, 2006

Posted by Carthik in applications, news, office, ubuntu.
41 comments

Evolution provides integrated mail, contact management and calendaring in one solid app. Sort of reminds one of Outlook on Windows, doesn’t it? Until now, there was no installer for Evolution in Windows. That just changed. Ubuntu users can now use their favourite mail+contacts+calender app in Windows too, if they have to at the office, or some other windows-only environment.

A new installer makes it possible to install Evolution on Windows
, to replace MS Outlook. Evolution is an MS Exchange client and should work with Exchange servers. If it does not do that perfectly, file some bugs and someone will fix it for you for free. Most of the windows-porting work seems to have been done by Tor, whose update informs everyone of the new installer for Windows.

Will Evolution be to Outlook what Firefox is to Internet Explorer? Time will tell.

Participate in the Popularity Contest July 16, 2006

Posted by Carthik in administration, applications, packages, ubuntu.
22 comments

The popularity-contest (popcon) package in Ubuntu lets you vote on your favorite, most-used apps and packages every week. This is an automated process, so once you set it up, you will never have to worry about it again. Below is a description of the package:

Vote for your favourite packages automatically. When you install this package, it sets up a cron job that will anonymously inform the developers about your most used packages.
This information helps us make decisions such as which packages should be promoted and so be in standard installs.

The results are available to everyone at popcon.ubuntu.com. Seeing as there are less than 2000 i386 (pentium) users that currently submit popcon information, I thought we could do better. So setup popcon and start submitting info about your usage of applications now – this is vital feedback for those who architect the distro – not to mention a lot of fun for everyone.

Here’s how you set it up. It is already installed, but inactive:
Execute the following command to reconfigure it:
$sudo dpkg-reconfigure popularity-contest

You can choose to submit stats via http, or via email. Both are automated processes, and I’d choose http for the convenience. If, however, you do choose email, note that you might have to take a small additional step to enable postfix to send the email properly. You can follow the instructions to setup a “smarthost” in postfix to ensure that your email gets sent and received without problems. I have my popcon set up to use the http protocol to send information. Since it is anonymous, it is not a threat to your privacy. So go ahead, and give ’em some feedback.

Introducing the Dapper-Commercial Repository July 8, 2006

Posted by Carthik in applications, news, ubuntu.
89 comments

It is not the death of freedom in Ubuntu land, but it certainly is the birth of one kind of freedom – freedom of choice.

Canonical, Ubuntu’s parent company has announced the dapper-commercial repository, where one will hopefully find packages released by commercial companies (read non-open-source) for use by Ubuntu users. Right now, all the repository has is Opera 9, and RealPlayer 10. Hopefully as time progresses, we will see more software, like, say, Skype, that are useful to users presently, though they are not open source, in this repository.

Some may say this is step backward for Ubuntu, but here’s some reasons this is not so, in my opinion:

1) The repositories are not Ubuntu repositories, they are on a seperate Canonical server. These repos are not included in Ubuntu by default, but users can add them if they like them. They are perfectly legal, with Canonical having laid the groundwork for distributing them.
2) I believe in freedom of choice – for me, I will use a superior product even if the source code is not free, if I feel like it! I am all for people making money off of their work, as long as they don’t start squashing or trashing other good things I like by wielding their power or influence. In short, let us all be, and we’ll probably like you, and even use you 😉 Maybe I should think more about writing down the reasons why and when I’d use a non-open-source product, just for the heck of it.

So, friends, don’t worry, and be happy that you have more choices. If you’d like to start using the new repository, to get opera 9 or realplayer 10, then add the following line to your list of repositories:
deb http://archive.canonical.com/ubuntu dapper-commercial main
(I personally find it easiest to manually edit the /etc/apt/sources.list file and add the line in.
Then you need to do a $sudo apt-get update, and you are all set. You can install opera 9, for example, by doing a
$sudo apt-get install opera

Neat.
I love Opera by the way, and would use it as my only browser if only they figured out a way to let me synchronize my bookmarks between multiple computers.

Download with Resume – gwget – GNOME Download Manager June 16, 2006

Posted by Carthik in applications, ubuntu.
28 comments

Today I found the perfect solution for downloading over slow or undependable internet connections. Though I already knew about wget, a command line tool, but it was a bit of a stretch to expect my uncle to use the command line time and again.

gwget to the rescue! This simple interface to the wget works really well. By default it resumes downloads when it is restarted. So if you are on a slow dialup connection and you want to download some large file, and can’t find a torrent for the file, you can use gwget.

Installing gwget is easy, you can search for it in synaptic, or you can do it from the terminal using:
$sudo apt-get install gwget

Once installed, it will be listed as “Download Manager” in your Applications->Internet menu.

You can add new urls for downloading and then close the window, gwget will then appear in the notification area as shown in the picture below:

gwget notification area

For more screenshots, visit the screenshots page at the gwget homepage.

If you plan on using gwget from now on, you should get the Firegot Firefox extension to make adding links directly from Firefox much easier.

How to Create a Screencast in Ubuntu June 8, 2006

Posted by Carthik in applications, guides, ubuntu.
126 comments

…In which we (finally!) figure out how to create screencasts in Ubuntu using a patched ffmpeg…

This is something I have wanted to do for a long time now. Screencasting can be very useful for explaining new concepts, demonstrating beta products, and heck, maybe even for filing better bug reports!

The screencasting method I present here is not something I came up with. I saw it first at Quim Gil’s blog. A commenter mentioned how there was an article at clemens.endorphin.org explaining the process, and even posted instructions on how to be able to do this. So, as usual, my job is to publicize what is already known to a few.

You will need to patch, compile, and use ffmpeg to generate the screencasts. Let me try and make it very easy to do:

Open a terminal, and create a new directory called “software” in your home directory. This is optional, you don’t have to do it, but I do this to keep things organized on my computer:
$mkdir software
$cd software

So now you are in the newly created “software” directory.

Get the source for ffmpeg:
$wget http://un.sh.nu/screencasts/ffmpeg-0.4.9-p20051216.tar.bz2

Extract it:
$tar xjfv ffmpeg-0.4.9-p20051216.tar.bz2

Change to the newly extracted directory:
$cd ffmpeg-0.4.9-p20051216

Download the patch:
$wget http://un.sh.nu/screencasts/ffmpeg-0.4.9-p20051216.diff

Apply the patch:
$patch -Np1 -i ffmpeg-0.4.9-p20051216.diff

Now before we start compiling the source, you will need a couple of packages installed on your computer. The “build-essential” package will give you the compiler and other tools needed to compile packages, and the “xlibs-dev” package will be required to compile ffmpeg successfully. Let’s install both of these:
$sudo apt-get install build-essential xlibs-dev

Let’s get started now, configure the beast:
$./configure --extra-ldflags=-L/usr/X11R6/lib --enable-x11grab --enable-gpl

…and then “make” it:
$make

That’s it! Now you have an executable called “ffmpeg” in the directory you are in (~/software/ffmpeg-0.4.9-p20051216/)

You can use this to create your screencasts.

I find the following command good for my purposes:
$./ffmpeg -vcodec mpeg4 -b 1000 -r 10 -g 300 -vd x11:0,0 -s 1024x768 ~/test.avi
..where:
-vd x11:0,0 says that the offset to use for recording is x=0 and y=0
and
-s 1024×768 says that the size of the video to be captured is 1024×768.
The video file “test.avi” will be created in your home folder.

You can change these and the other options (refer to the documentation for ffmpeg).

If you want to create a screencast of only one application window, or a specific portion of your desktop, you can do that by specifying the offsets (always calculated from the top-left of the desktop) and the size of the area to be captured.

I find the “xwininfo” command to be pretty useful to find these parameters.
$xwininfo -frame will give you the geometry of a window, including the window decorations (the title-bar, scrollbar etc).

You can resize the screencasts by using, (…surprise!…) ffmpeg. For example the following command will create a 800×600 video from the 1024×768 video:
./ffmpeg -vcodec mpeg4 -b 1000 -r 10 -g 300 -i ~/test.avi -s 800×600 ~/test-800-600.avi

I created a small screencast to show how all this works out. However, the video quality at youtube and google videos leaves much to be desired. The original is much, much better — you can actually read the text in the screencast.

YouTube-hosted Screencast – A demo of the method where I learn to use xwininfo:

The same video/screencast is also on Google videos, andI really can’t decide which is worse, google, or youtube! I have posted the original .avi file here (test-small.avi) – which shows the quality of the screencast before it was uploaded to youtube.

Creating a screencast, even with an easy-to-use tool, is hard. I had to do this one over and over till I was marginally happy with one. Unlike with writing an article, you can’t go back and change things — you have to start re-recording from scratch! Besides that, there are issues like accents. (Question – can you place me geographically just by my accent? – let’s see how close, and specific, you can get 🙂 )

So I’ve done my teeny-weeny bit. Now someone please write us a small, stable GUI app that does the same thing. There’s no need for too many bells and whistles, a start/stop button, a method to select an area of the desktop to record, and a “save to…” field will do nicely.

So what do you folks think we can use this new tech for? I can’t think of too many screencasts to create, now that I have a method of creating them.