Showing posts with label ssh. Show all posts
Showing posts with label ssh. Show all posts

Friday, 19 February 2016

SSH Don't offer a key, use a password

This is a problem i've been having more and more as my collection of keys and ~/.ssh.config grows. Sometimes you just need to log in with a password but ssh will try all of your keys and then the server prevents you from trying a password challenge because you've failed too many logins e.g.

Received disconnect from 10.12.66.18: 2: Too many authentication failures for ...

Just use ssh -o PubkeyAuthentication=no 

Thursday, 17 January 2013

SSH Pseudo terminals

There is always so much more to SSH than I know about.  Here is another discovery I made today.  This allows me to ssh into a machine via a gateway in just one command care of the -t flag

ssh -t agatewaymachine.com "ssh 192.168.1.253"

Wednesday, 25 January 2012

SSH Piping between remote servers

SSH is without doubt my favourite command line tool. Today I needed to transfer a file between two hosts that I could SSH to, but could not SSH to each other. This is really simple with a bit of standard UNIX piping.

ssh hostA cat somescript.sh | ssh hostB "cat > somescript.sh"

Job done.

Monday, 13 December 2010

using a remote machine as a proxy with SSH

This is such a useful feature of SSH that I wish I had know about before now.

When working remotely from an insecure location, or when only the remote location is trusted by another host, e.g for a firewall login or viewing intranet pages you only have access to from a certain machine; you can use a remote machine as a SOCKS proxy straight out of the box.

e.g. on the localmachine, run:

ssh -fND 1234 username@yourremotemachine

This will create a SOCKS proxy on localhost port 1234
-f flag tells the shell to fork and run in the background
-N Leaves no login shell
-D 1234 sets up a SOCKS proxy via port 1234 on the localhost

On the local machine you can then set the browser to use the SOCKS 5 proxy on localhost port 1234

Tuesday, 20 July 2010

Simple SSH Tunneling

Today I had a problem where the office firewall would not let out traffic to the fibs.com server on port 4321 (Shame on them!)

Luckerly a remote machine comes in handy. I then just tell my Fibs client to connect on localhost port 4444

ssh -f -L 4444:fibs.com:4321 aremotemachine -N