Linux Blog

Tether iPhone through the cable, on Linux

Filed under: General Linux — TheLinuxBlog.com at 10:02 am on Thursday, August 20, 2009

So you got an iPhone huh? perhaps you’ve got an SSH client and maybe you jailbroke your iPhone and have done some iPhone wifi tethering (That’s not the best way, and not free), but have you been able to use SSH through the cable? Me neither until a little while ago.

The benefits of connecting by the cable are slightly obvious to anyone who wants to do it:

BATTERY!
With your phone plugged in, you’ll get better battery life, or perhaps just prevent the battery from getting discharged any further.

No Wifi Setup
This was really the biggest problem for me, having to reconfigure wifi on my laptop then getting the laptop and phone to talk. Some times wireless connections mysteriously dropped or just acted plain funky. Any one who’s ever typed in a WEP key on the iPhone also knows what a pain it is, so not having to use Wifi is a plus.

Privacy
Since the cable is used, there should be no wireless network for others to fool around with.

Data Transfer Rates
I have not yet confirmed this, mostly because I’m lazy, partly because I don’t have the time to produce any stats but, 480Mbps with USB2.0 Vs. a theoretical 54Mbps on 802.11G

Enough already, how do I do it?
Thanks to Jing Su there is a LGPL’d piece of software called itunnel that can be found here. Installing itunnel will vary by distribution. It’s fairly straight forward on Fedora, provided you have the library libiphone installed you should be able to download, untar, make, and run.

Once you’ve installed itunnel, you run it by using:

sudo itunnel <port>

If you don’t specify a port it listens on port 3023.

Connect to localhost using your normal SSH Socks proxy method -D <port> and your username, default being mobile with your new port.

 ssh -D <yourport> -p 3023 mobile@localhost

Type “Yes” to accept the fingerprint (you may need to eventually change your fingerprint when you upgrade your phone) and then type in your password which should NOT be “alpine”, because you did change it right?

Once you’re SSH’d in, you can set up your browser to use the socks proxy as you would with Wifi tether version on the port you specified with -D.

There you have it, a way to Tether your iPhone through the cable on Linux! Rumor, (well not really a rumor, since I’ve used itunnel.exe) has it that this also works with a Windows box, just try to find a non-virus infected version of the iTunnel suite.

Happy Hacking!

Thunderbird localmail Spool

Filed under: Linux Software — TheLinuxBlog.com at 1:13 pm on Friday, July 3, 2009

Thunderbird

I was in a bit of a bind the other day when I learned that an IMAP server I was using was going to dissapear. I wanted to backup all of my mail, but had too many messages hosted on the IMAP server to copy from one to another, so I decided I’d download them all locally first and then deal with them later. I used fetchmail to download all of my messages from the IMAP main folder to my local spool, and copied over all of the sub folders because I was in a rush and needed to copy them quickly.

Once they were in my local mail spool, I wanted to get them into Thunderbird, but learned that the option I had once used to read my localmail had gone. There used to be an option for it in the GUI, but somewhere along the line it got removed. After a bit of Googling, I found: http://lists.freebsd.org/pipermail/freebsd-questions/2003-December/027652.html

This worked for me, and should work for any one that wants to use Thunderbird to read local mail.

Basically, you add a new mail account in Thunderbird as usual, then close it. Get into your local profile directory by using

cd .thunderbird/[tab]

then

vi prefs.js

find your new mail server, with the bogus name and change the hostname to localhost, change your name to <yourusername>@localhost, the server type to movemail, and change the userName to your username. It should look something like the following:

user_pref(“mail.server.server4.hostname”, “localhost”);
user_pref(“mail.server.server4.name”, “owen@localhost”);
user_pref(“mail.server.server4.type”, “movemail”);
user_pref(“mail.server.server4.userName”, “owen”);

Once thats done, you can restart Thunderbird and fetch your mail as usual. From there you can do as you wish with your messages.

Excellent! My question really is why was the GUI option removed from Thunderbird? Whatever the answer this method still works, so if you need to, use it while you still can!

Use VNC through SSH

Filed under: Quick Linux Tutorials — TheLinuxBlog.com at 11:33 am on Thursday, November 20, 2008

Here is another quick tutorial;

Some times its nice to tunnel through SSH. Perhaps you have SSH running but the firewall does not allow anything but SSH in. You can tunnel VNC (or any other service) through SSH by doing the following:

On the machine local to you establish an SSH connection to the remote machine with “Local (-L)”  port forwarding. This may seem confusing and often confuses me, where <-p PORT> is optional

 ssh -L 5901:localhost:5900 username@HOST <-p PORT>

Once I have the connection established I can now use vncviewer to connect to my local host with the port specified

vncviewer  localhost:5901

Thats all there is to it, have fun!

Using Subversion with SSH & Custom Ports

Filed under: Linux Software,Quick Linux Tutorials — TheLinuxBlog.com at 9:09 am on Monday, September 15, 2008

Lets say you use subversion on your home PC to keep track of projects and you want to checkout or export your project from a remote location. Here’s the catch, sshd is running on a custom port or forwarded from another. For some reason the command line SVN client does not support a port parameter when using the defacto svn+ssh://

svn co svn+ssh://thelinuxblog.com/owen/svn/project1/trunk project1
ssh: connect to host thelinuxblog.com port 22: Connection refused

Well we know why the error above happens its because I happen to run SSH on port 1337. The following work around requires root privileges, and may mess with your system a bit but if you really need to check something out, then it will work.

As root, login and stop SSH if you run it. With SSH Forward port 22 with a local SSH forwarding connection to the remote host.

[owen@thelinuxblog.com]$ sudo su -
[root@thelinuxblog.com]$ /sbin/service sshd stop
[root@thelinuxblog.com]$ ssh -p 1337 owen@thelinuxblog.com-L 22:<internal ip>:1337

Once this is done, your localhost:22 now forwards to your remote host. With another session (on your local machine) you can verify the connection by using ssh localhost. You will probably get warnings about the hosts identity being changed, or not verifying it, but you can ignore then. Once you’ve tested it, just use SVN as normal. When finished, remember to logout of the SSH session, and start SSH back up again if you run it.