Schematic:
ssh ssh
A ------> B ------> C
^ ^
using A's using B's
ssh key ssh key
Preconditions:
A
is running ssh-agent;A
can accessB
;B
can accessC
;A
‘s ssh public key is present inB:~/.ssh/authorized_keys
B
‘s ssh public key is present inC:~/.ssh/authorized_keys
In ~/.ssh/config
on A
, add
Host C
ProxyCommand ssh -o 'ForwardAgent yes' B 'ssh-add && nc %h %p'
If your ssh private key on B is in a nonstandard location, add its path after ssh-add
.
You should now be able to access C
from A
:
A$ ssh C
C$
Related Posts:
- Pseudo-terminal will not be allocated because stdin is not a terminal
- Pseudo-terminal will not be allocated because stdin is not a terminal
- Is it normal to get hundreds of break-in attempts per day?
- Keeping a linux process running after I logout
- Can you have more than one ~/.ssh/config file?
- How can I fully log all bash scripts actions?
- How do I deal with a filename that starts with the hyphen (-) character?
- Bash: No such file or directory?
- Why do you need to put #!/bin/bash at the beginning of a script file?
- “Couldn’t find a file descriptor referring to the console” on Ubuntu bash on Windows
- performing HTTP requests with cURL (using PROXY)
- gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now
- Pass a password to ssh in pure bash
- -bash: syntax error near unexpected token `newline’ for display command
- How do I use grep to search the current directory for all files having the a string “hello” yet display only .h and .cc files?
- “sed” command in bash
- mysql_config not found when installing mysqldb python interface
- How to set proxy for wget?
- Explaining the ‘find -mtime’ command
- How does “cat << EOF" work in bash?
- ssh: Could not resolve hostname [hostname]: nodename nor servname provided, or not known
- X11 forwarding request failed on channel 0
- Extract file basename without path and extension in bash
- Given two directory trees, how can I find out which files differ by content?
- mv: cannot stat error : No such file or directory error
- mysql_config not found when installing mysqldb python interface
- ./configure : /bin/sh^M : bad interpreter
- How to download a file from server using SSH?
- Trying to use bash on Windows and got no installed distributions message
- What is the difference between “#!/usr/bin/env bash” and “#!/usr/bin/bash”?
- -bash: fork: Cannot allocate memory
- Is there a “goto” statement in bash?
- Bash script: bad interpreter
- connect to host localhost port 22: Connection refused
- How to count lines in a document?
- What does `set -x` do?
- How to get the process ID to kill a nohup process?
- Writing a simple shell in C using fork/execvp
- chmod: changing permissions of ‘my_script.sh’: Operation not permitted
- Getting stty: standard input: Inappropriate ioctl for device when using scp through an ssh tunnel
- tar: add all files and directories in current directory INCLUDING .svn and so on
- What does set -e mean in a bash script?
- What does set -e mean in a bash script?
- “find: paths must precede expression:” How do I specify a recursive search that also finds files in the current directory?
- Bash script prints “Command Not Found” on empty lines
- Pipe to/from the clipboard in a Bash script
- Linux Bash: Move multiple different files into same directory
- How do I write stderr to a file while using “tee” with a pipe?
- How to include file in a bash shell script
- How to enable Bash in Windows 10 developer preview?
- EC2 ssh Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
- What does ‘bash -c’ do?
- bash sh – command not found
- How do I know the script file name in a Bash script?
- How to configure WP filesystem access in Linux (Ubuntu Server)?
- How can I sort du -h output by size
- What are the functional differences between .profile .bash_profile and .bashrc
- Can I automatically add a new host to known_hosts?
- Can I nohup/screen an already-started process?
- Permission denied (publickey). SSH from local Ubuntu to Amazon EC2 server
- How to run a command multiple times, using bash shell?
- How to reconnect to a disconnected ssh session
- how to disable SSH login with password for some users?
- How do I prevent accidental rm -rf /*?
- How do I sleep for a millisecond in bash or ksh
- What is “-bash: !”: event not found”
- What’s the best way to check if a volume is mounted in a Bash script?
- What useful things can one add to one’s .bashrc? [closed]
- How to add a timestamp to bash script log?
- best way to clear all iptables rules
- How to check if an RSA public / private key pair match
- how do you create an ssh key for another user?
- Colors in bash after piping through less?
- REJECT vs DROP when using iptables
- Linux command line best practices and tips?
- How to run command as user who has /usr/sbin/nologin as Shell?
- “POSSIBLE BREAK-IN ATTEMPT!” in /var/log/secure — what does this mean?
- How to get pid of just started process
- Does getting disconnected from an SSH session kill your programs?
- Show all users and their groups/vice versa
- SSHFS mount that survives disconnect
- Temporarily ignore my `~/.ssh/known_hosts` file?
- What’s wrong with always being root?
- Hundreds of failed ssh logins
- How to apply a filter to real time output of `tail -f `?
- protocol version mismatch — is your shell clean?
- How to remove invalid characters from filenames?
- zcat/gzcat works in linux, not on osx. general linux/osx compatibility
- How do I grep recursively?
- what does -zxvf mean in tar -zxvf filename?
- WordPress can’t find temporary folder, but folder it’s looking at has correct permissions
- Meaning of the buffers/cache line in the output of free
- How to cd into a directory with this name “-2” (starting with the hyphen)?
- Is it possible to detach a process from its terminal? (Or, “I should have used screen!”) [duplicate]
- How can I port forward with iptables?
- Why do we use a OS Base Image with Docker if containers have no Guest OS?
- How to make Windows 7 USB flash install media from Linux?
- How to install/change locale on Debian?
- What limits the maximum number of connections on a Linux server?
- How to do the port forwarding from one ip to another ip in same network?