Tethering Your Android to Linux (without rooting your phone)

Posted in computers on March 2nd, 2010 by karrth

If you’re stuck in an area with no internet connection except your Android phone, you can use your phone as a proxy for your laptop’s internet connection.

Setup on AndroidProxoid barcode for Android

First, you need to enable USB Debugging by going to Settings/Applications/Development/ and clicking the checkbox.  Be sure to plug your Android device into your computer with the USB cable.

Next, you need to install Proxoid.  You can do this by searching the market on your phone, or scanning the barcode to the right.

The final step is to open up the application, and check the “Start/Stop Proxoid” box.

Tethering the Phone

The first thing you need is the Android SDK.  Download it and extract the contents into /opt/android/

As root, create the file /etc/udev/rules.d/90-android.rules
with these contents:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"

Now as root, create the file /usr/sbin/tether
with these contents (or download it here):

#!/bin/bash
/opt/android/tools/adb kill-server
/opt/android/tools/adb start-server
/opt/android/tools/adb devices
/opt/android/tools/adb forward tcp:8080 tcp:8080

Make sure you make the file executable:
chmod 744 /usr/sbin/tether

Finally, run the program tether as root.

If you’re having issues, try running each command in the tether file individually so you can see any error messages.

If you don’t setup the “Run as a service” section below, type

killall adb

as root to disconnect your tether.

Setting up the proxy in Firefox

Go to Edit/Preferences/Advanced/Network/Settings…

Under the HTTP Proxy, type “localhost”, and under Port type “8080″ so it looks like the screenshot below:

Firefox Proxoid Proxy SettingsHit “Ok” twice to get out of your Preferences window, and you should be good to go!

Optional: Make it a service in Arch Linux

You can do this in other Linux distros as well, but for Arch you can download this file to /etc/rc.d/tetherd.

As root, chmod it as such to make it executable:

chmod 744 /etc/rc.d/tetherd

Now you can start tether automatically as a service by putting it in your rc.conf file, or manually by typing:

/etc/rc.d/tetherd { start | stop | restart }

Enjoy!

Further Reading

Tags: , , ,

Busting Out of Your Firewall with SOCKS

Posted in computers on February 25th, 2010 by karrth

Most people find themselves accessing the internet from somewhere besides their home, and often times there are restrictions on the network that disable some protocols, or maybe block some websites you’d like to see.  An easy way to get around this is to forward your web session over an ssh session.  This can be done in any OS… the only requirement being that you have an ssh server setup outside of the network you are currently on.  The port I’ve chosen (8080) is arbitrary – you can choose anything above 1024.

Windows

Download putty, and type the name of your ssh server in the Host Name field.  Now select (Under “Category:”) Connection/SSH/Tunnels.

Putty SSH port forwardingUnder source port, enter “8080″ and select “Dynamic” under that.  Next, hit “Add”, which should add “D8080″ under “Forwarded Ports”.  Now hit open, and login to your machine.

Finally, you need to setup Firefox to go through your proxy.  Go to: Tools/Options/Advanced/Network/Settings…

Firefox network settingsEnter “localhost” under the SOCKS Host and “8080″ under the Port.  Make sure that SOCKS v5 is selected under that.

Hit “Ok” a couple times to get out of your configuration windows, and you’re good to go!

Linux/Mac

Now things are a little simpler under Linux/Mac.  All you need is ssh.  Simply type in terminal:
ssh -D8080 username@host.com

And set your browser’s proxy settings like we did above for Windows.

Further Reading

Tags: , , ,

Linux CLI programs to replace your GUI

Posted in computers on January 21st, 2010 by karrth

While many people enjoy using their GUI, sometimes it is just not efficient to do so.  Or maybe you don’ t have the resources to load an X-Window manager… So  I present to you some very useful programs that don’t need X.

System Tools

  • htop – like top (processes monitor), but with colors and an improved interface
  • iftop - instead of monitoring processes, it monitors your ethernet devices and displays connection speeds and average transfer rates
  • mkisofs and cdrecord - make an ISO and then burn it to disc!
  • screen – a terminal multiplexer that allows you to manage virtual terminal sessions within your one session.  Think of it as multiple desktops for the terminal.
  • smbstatus – if you run a Samba server/share on your machine, you can see here who’s connecting to it and what files they have open
  • wireless-tools – gives you a couple programs including iwconfig and iwlist that make it easy to connect to a wireless AP through terminal
  • wpa_supplicant – needed if you want to connect to a WPA encrypted AP with the wireless-tools.  Here’s a quick tutorial.

Internet

  • finch – chat with your friends (or enemies) with this terminal version of Pidgin
  • irssi - an amazing slick little IRC chat client
  • lynx and elinks – both are text based web browsers so you can cruise the web without those pesky graphics
  • mutt – read your Gmail (or other mail) from the terminal.  Mutt supports IMAP, POP3, and SSL Certificates, among other things.
  • rtorrent - this torrent client is great for sending to the background with screen, and even watches folder for new torrent files.  Check out this user guide for help.

Media

  • mplayer/mencoder- did you know that it was not only a media player, but that you could convert video, audio, or even rip dvds?  Doh!
  • moc - gives you a nice ncurses interface for playing music on your terminal
  • ushare – share your media with your Xbox 360 or PS3.  There’s also a web and telnet interface you can use once you’ve started the program.

Be sure to check the man pages for all the features these programs offer!  And don’t forget to explore the programs that are already on your machine – you’d be surprised and what’s there already.

Further reading:

Tags: , ,