Archive for February, 2013

Proxy web traffic through another server using ssh.

Totally swiped this from a Linux Journal podcast, but it was so good I wanted to write it down for future reference:

# ssh -N -D someportnumber username@somesshserver

Then, enter your password and configure your browser to use SOCKS host version 4 or 5 with localhost and the port you used.

For example:

# ssh -N -D 1080 jim@11.22.33.44

Browser configuration:

ProxySettings

Convert UTF-16 file to UTF-8

A lot of times, I find myself creating output files in Windows that I want to use linux to parse because I am more comfortable scripting in linux than in Windows. Most times I the output UTF-16 encoded. You can tell by using the file command. I used this to convert a file generated in Windows 2003 server, so that I could work with it in CentOS 6.x.

$ file myfilename.txt
myfilename.txt: Little-endian UTF-16 Unicode text, with CRLF line terminators

Then, to convert the file:

$ iconv -f utf-16 -t utf-8 myfilename.txt > mynewfilename.txt

Return top

INFORMATION