News for hackers. Stuff that matters.
Re:SSH Agent Explained by hylaride on Wednesday May 20, 2020 @09:57AM (#23246808)
You can setup an `~/.ssh/config` file to make it easier:

  Host *
   ControlMaster auto
   ControlPath ~/.ssh/ssh_mux_%h_%p_%r
  Host host1
   HostName 1.2.3.4
   LocalForward 45432 db.internal.net:5432
   User user1
  Host host2
   HostName host2.whatever.com
   LocalForward 46432 db2.internal.net:5432
   User user2
This way you can now scp/ssh to [email protected] with just this:

  scp file host1:
  ssh host1
It also setups up port forwarding. In that case I can connect a postgresql client to localhost 45432 and it'll forward (assuming the ssh host has network access to it) the tcp connection to the host db.internal.net . I do this to use GUI SQL clients to our back-end DB.

The Control options setup ssh multiplexing. If you ssh into a host, subsequent connections piggy-back off of the initial connection. This is useful if you have 2fa and don't want to do 2 factor for every connection.

There's much more you can do: https://linux.die.net/man/5/ssh_config

There are no comments on this comment yet.