Step 1:
In PuTTY create a new session to connect to the SSH server which has the access to the restricted web site:
1. Go to Connection->SSH->Tunnels
2. Fill in the Source port e.g. 8888
3. Select option: Dynamic
4. Click on the Add button to add the forwarded port.
5. Save the session.
Step 2:
Use PuTTY to open a connection to the SSH server with the new session.
Step 3:
In Firefox:
1. Go to Tools->Options
2. Scroll to the end or search "Proxy".
3. Click on the Settings button for Network Proxy.
4. In the Connection Setting, select Manual proxy configuration
5. Fill in the proxy with the port we set earlier (e.g. 8888):
SOCKS Host: 127.0.0.1
Port: 8888
6. Click on OK to save the changes
Firefox will send all the traffic through the SSH server. Remember to change it back after use.
Now you can access the restricted web site with Firefox.
Showing posts with label SSH. Show all posts
Showing posts with label SSH. Show all posts
Friday, May 31, 2019
Wednesday, May 22, 2019
SSH force command to copy files with SCP
1. Add the public key to ~/.ssh/authorized_keys with the force command (using python script as an example):
COMMAND="mysshcmd.py",FROM="192.168.1.108",NO-AGENT-FORWARDING,NO-PORT-FORWARDING,NO-PTY,NO-USER-RC,NO-X11-FORWARDING ssh-rsa AAAAB3N......
2. On the client side with the private key, run the scp command to copy a directory:
$ scp -o StrictHostKeyChecking=no -r . username@hostname:/path/to/destination
3. In the file mysshcmd.py on the server side, add the code to handle the scp copying:
origCommandParm = os.environ['SSH_ORIGINAL_COMMAND']
origCommandParmArray = origCommandParm.split()
commandName = origCommandParmArray[0]
if commandName == "scp" :
destination = origCommandParmArra[3]
cpCommand = "scp -r -d -t " + destination
os.system(cpCommand)
COMMAND="mysshcmd.py",FROM="192.168.1.108",NO-AGENT-FORWARDING,NO-PORT-FORWARDING,NO-PTY,NO-USER-RC,NO-X11-FORWARDING ssh-rsa AAAAB3N......
2. On the client side with the private key, run the scp command to copy a directory:
$ scp -o StrictHostKeyChecking=no -r . username@hostname:/path/to/destination
3. In the file mysshcmd.py on the server side, add the code to handle the scp copying:
origCommandParm = os.environ['SSH_ORIGINAL_COMMAND']
origCommandParmArray = origCommandParm.split()
commandName = origCommandParmArray[0]
if commandName == "scp" :
destination = origCommandParmArra[3]
cpCommand = "scp -r -d -t " + destination
os.system(cpCommand)
Subscribe to:
Posts (Atom)