The runsocks Script
The SOCKS5 distribution comes with a compile option to build a dynamically linked library (/usr/1oca1/1ib/1ibsocks5_sh.so) that can be used by native Linux client applications in conjunction with a SOCKS5 server. The script /usr/local/bin/
runsocks works by adding the location of the SOCKS5 dynamic library to the front of the standard Linux $LD_LIBRARY_PATH, and effectively SOCKS-ifies any standard Linux network clients by replacing references to the commonly used Berkeley Sockets systems calls with their SOCKS5 equivalents.
Notice that the runsocks script is only effective for clients that have been compiled with support for dynamic loading of shared libraries. Applications that have been built to include static libraries cannot be executed by runsocks. Listing 10.4 shows how to use runsocks with the standard Linux ftp client to contact a remote FTP server (public.example.com) through a Proxy server (proxy.example.com). Note that there are three environment variables that need to be set prior to runsocks execution: $SOCKS5_ SERVER, $SOCKS5_USER, and $SOCKS5_PASSWD. These variables specify which proxy server to use and the username and password to use for authenticating to the proxy server. These variables can also be defined in the libsocks5.conf file, which is explained in detail in the next section.
Listing 10.4 Using the runsocks script
[ramon]$ export SOCKS5_SERVER=proxy.example.com [ramon]$ export SOCKS5_USER=ramon [ramon]$ export SOCKS5_PASSWD=mypassword [ramon]$ runsocks ftp public.example.com
220 public FTP server (Version wu-2.4.2-VR17(1)
Mon Apr 19 09:21:53 EDT 1999) ready.
Name (public.example.com:ramon):
331 Password required for ramon.
Password:
230 User ramon logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
Continue reading here: SOCKS5 Shared Library Configuration
Was this article helpful?