Tuesday, June 14, 2011

Proxify terminal commands and/or applications

Objective: Use commands such as wget, apt-get, etc under a SSH proxy.

Problem: There's no option to run them natively under a proxy or configure it.

Walkthrough:
1 - Download tsocks ($sudo apt-get install tsocks)

2 - Proxify: ($sshpass -p password ssh account@IP -p port -D dynamic_port)
sshpass allows to pass a password into the interactive shell that ssh uses.

3 - Configure tsocks conf file.
### Begin file /etc/tsocks.conf
server = 127.0.0.1
# Server type defaults to 4 so we need to specify it as 5 for this one
server_type = 5
# The port defaults to 1080 but I've stated it here for clarity
server_port = dynamic_port
###End of file /etc/tsocks.conf

4 - Run any commands with tsocks as prefix.
E.g. $tsocks pidgin

No comments:

Post a Comment