InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Ssh tutorials

  • Create ssh public/private keys on command line
  • Check if an ssh key has passphrase
  • Connect to mysql server using ssh port forwarding
  • Display keys added to ssh-agent using ssh-add
  • Find authentication methods an ssh server supports
  • Generate ssh public key from private key
  • Linux - how to enable password login on ssh server
  • Linux - ssh agent forwarding when using bastion host
  • Prevent ssh session freezing due to timeout
  • Remove passphrase from ssh private key
  • Ssh port forwarding to surf a site from different location
 
  • Home
  • > Tutorials
  • > Linux/Unix Command Line
  • > SSH

Linux – ssh agent forwarding when using bastion host

on Jun 18, 2016

When using a bastion host (or Jumpbox) to connection to production server using ssh private keys, ssh agent forward can be used. The main advantage is that you wont have to copy you keys on bastion host and hence your keys are more secure.

Using command line option -A

Use -A option when connecting to bastion host. Then you can connect to target host without having to specify your keys again.

$ ssh -i PRIVATE_KEY_FILE -A bastionhost.com

## On bastion host check env variable SSH_AUTH_SOCK
$ echo $SSH_AUTH_SOCK
/tmp/ssh-gDJRG7maIa/agent.26247

## now connect to productionhost.com from bastion host
$ ssh productionhost.com

Using ~/.ssh/config

Alternatively update ssh config file on you laptop/desktop to enable agent forwarding when connecting to bastionhost.com

Host bastionhost.com
  ForwardAgent yes

Suggested posts:

  1. How to create simple animation using Inkscape and Jquery
  2. How to migrate wordpress from root to sub directory
  3. Find image unique colors and bit depth using imagemagick identify
  4. Mysql – display row count and size of tables
  5. Custom terminal tab title and ssh on mac
  6. Setup xdebug for remote wordpress debugging
  7. Docker managing images – command line cheat sheet
  8. How to use exerciser monkey tool for android stress testing
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Devops, Linux, SSH, Tutorials, Ubuntu Linux
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress