Skip to main content

Posts

Showing posts from February, 2012

Using ssh as proxy to bypass firewall, or use existing server to connect to internet

Prerequisite 1.        You have ssh access to a server, the server has public internet access 2.        On Windows, You can change proxy settings on your web browser or any program you want to access to internet, Or 3.        On Linux, You can compile c program Tech explains: ssh has a feature to enable socks 5 proxy server   on your own local machine when you connect to the server. Then on the local machine, configure proxy settings will let you use the internet access (or intranet access) on that server. There’s also a program on Linux which can use http, socks4 or/and socks5 proxy to proxy any program. For example, you want to FTP to internet but the FTP program didn’t provide proxy settings, then you can use this program to do the proxy in the background for you. Steps (for Windows): 1.        Connect to you server using ssh with below syntax:     a.        ssh –D <local proxy port> -N <yourUserName>@<yourServer or IP address>     b.       example:   ssh

Linux/Unix which command equivalent on Windows

"which" command on Linux can help locate executable files, somethings we need same function on windows. Here's how: if you're using Windows 7, there's a building command "where", so if you want to find where is "notepad.exe" for Microsoft Word, just fire up and command window and type: where notepad.exe you'll get something like: C:\>where.bat notepad.exe C:\WINDOWS\system32\notepad.exe C:\WINDOWS\notepad.exe on Windows XP, there's no build-in command, so create a batch file called where.bat with below content: @echo off for %%i in (%1) do if not ""=="%%~$PATH:i" echo %%~$PATH:i now, run where notepad.exe you'll get something like: C:\>where.bat notepad.exe C:\WINDOWS\system32\notepad.exe you can save the file in windows directory, so you can use it anywhere Attention: only executable list in environment variable PATH can be found just like the way Linux/Unix works.