Skip to main content
Correct ssh config file
Source Link

This is a GREAT question, I always wondered too.

The short answer is No.. You cannot. So I decided to do it myself.

You can use a simple script to get the the desired functionality.

I wrote a Github Pages post for this


TLDR

On UNIX Try this:
(On Windows, read my Github Pages Post)

~/.ssh/scripts/check-host-fingerprint.sh

#!/bin/bash

fingerprints=$(ssh-keygen -lf <(ssh-keyscan $1 2>/dev/null))

for fingerprint in $fingerprints
do
        if [ "$fingerprint" == "$2" ]
        then
                exit 0
        fi
done

exit 1

~/.ssh/config


# Host with Global Fallback
Host my_auto_host
    User username
    Match host "my_auto_host" exec "/bin/bash %d/.ssh/scripts/check-host-fingerprint.sh 192.168.0.100 SHA256:12345678901234567890123456789012345678901234567"
        Hostname 192.168.0.100
    Port 22
Host my_auto_host
    PortUser 22username
    Hostname server.domain.org
    Port 1022

# Secondary Host using Primary as Proxy
Host secondary
    User u5ernam3
    Hostname 192.168.0.101
    Port 22
    ProxyJump my_auto_host

If this doesnt work for you, Please read my Github Pages post.
It it still doesn't work, feel free to contact me by email (can find on blog sidebar/footer).

This is a GREAT question, I always wondered too.

The short answer is No.. You cannot. So I decided to do it myself.

You can use a simple script to get the the desired functionality.

I wrote a Github Pages post for this


TLDR

On UNIX Try this:
(On Windows, read my Github Pages Post)

~/.ssh/scripts/check-host-fingerprint.sh

#!/bin/bash

fingerprints=$(ssh-keygen -lf <(ssh-keyscan $1 2>/dev/null))

for fingerprint in $fingerprints
do
        if [ "$fingerprint" == "$2" ]
        then
                exit 0
        fi
done

exit 1

~/.ssh/config


# Host with Global Fallback
Host my_auto_host
    User username
    Match host "my_auto_host" exec "/bin/bash %d/.ssh/scripts/check-host-fingerprint.sh 192.168.0.100 SHA256:12345678901234567890123456789012345678901234567"
        Hostname 192.168.0.100
        Port 22
    Hostname server.domain.org
    Port 1022

# Secondary Host using Primary as Proxy
Host secondary
    User u5ernam3
    Hostname 192.168.0.101
    Port 22
    ProxyJump my_auto_host

If this doesnt work for you, Please read my Github Pages post.
It it still doesn't work, feel free to contact me by email (can find on blog sidebar/footer).

This is a GREAT question, I always wondered too.

The short answer is No.. You cannot. So I decided to do it myself.

You can use a simple script to get the the desired functionality.

I wrote a Github Pages post for this


TLDR

On UNIX Try this:
(On Windows, read my Github Pages Post)

~/.ssh/scripts/check-host-fingerprint.sh

#!/bin/bash

fingerprints=$(ssh-keygen -lf <(ssh-keyscan $1 2>/dev/null))

for fingerprint in $fingerprints
do
        if [ "$fingerprint" == "$2" ]
        then
                exit 0
        fi
done

exit 1

~/.ssh/config


# Host with Global Fallback
Match host "my_auto_host" exec "/bin/bash %d/.ssh/scripts/check-host-fingerprint.sh 192.168.0.100 SHA256:12345678901234567890123456789012345678901234567"
    Hostname 192.168.0.100
    Port 22
Host my_auto_host
    User username
    Hostname server.domain.org
    Port 1022

# Secondary Host using Primary as Proxy
Host secondary
    User u5ernam3
    Hostname 192.168.0.101
    Port 22
    ProxyJump my_auto_host

If this doesnt work for you, Please read my Github Pages post.
It it still doesn't work, feel free to contact me by email (can find on blog sidebar/footer).

Grammar
Source Link

This is a GREAT question, I always wondered too.

The short answer is No.. You cannot. So I decided to do it myself.

You can use a simple script to get the the desired functionality.

I wrote a Github Pages post for this


TLDR

On UNIX Try this:
(On Windows, read my Github Pages Post)

~/.ssh/scripts/check-host-fingerprint.sh

#!/bin/bash

fingerprints=$(ssh-keygen -lf <(ssh-keyscan $1 2>/dev/null))

for fingerprint in $fingerprints
do
        if [ "$fingerprint" == "$2" ]
        then
                exit 0
        fi
done

exit 1

~/.ssh/config


# Host with Global Fallback
Host my_auto_host
    User username
    Match host "my_auto_host" exec "/bin/bash %d/.ssh/scripts/check-host-fingerprint.sh 192.168.0.100 SHA256:12345678901234567890123456789012345678901234567"
        Hostname 192.168.0.100
        Port 22
    Hostname server.domain.org
    Port 1022

# Secondary Host using Primary as Proxy
Host secondary
    User u5ernam3
    Hostname 192.168.0.101
    Port 22
    ProxyJump my_auto_host

If this doesnt work for you, Please read my Github Pages post.
It it still doesn't work, feel free to contact me by email (can find on blog sidebar/footer).

This is a GREAT question, I always wondered too.

The short answer is No.. You cannot. So I decided to do it myself.

You can use script to get the the desired functionality.

I wrote a Github Pages post for this


TLDR

On UNIX Try this:
(On Windows, read my Github Pages Post)

~/.ssh/scripts/check-host-fingerprint.sh

#!/bin/bash

fingerprints=$(ssh-keygen -lf <(ssh-keyscan $1 2>/dev/null))

for fingerprint in $fingerprints
do
        if [ "$fingerprint" == "$2" ]
        then
                exit 0
        fi
done

exit 1

~/.ssh/config


# Host with Global Fallback
Host my_auto_host
    User username
    Match host "my_auto_host" exec "/bin/bash %d/.ssh/scripts/check-host-fingerprint.sh 192.168.0.100 SHA256:12345678901234567890123456789012345678901234567"
        Hostname 192.168.0.100
        Port 22
    Hostname server.domain.org
    Port 1022

# Secondary Host using Primary as Proxy
Host secondary
    User u5ernam3
    Hostname 192.168.0.101
    Port 22
    ProxyJump my_auto_host

If this doesnt work for you, Please read my Github Pages post.
It it still doesn't work, feel free to contact me by email (can find on blog sidebar/footer).

This is a GREAT question, I always wondered too.

The short answer is No.. You cannot. So I decided to do it myself.

You can use a simple script to get the the desired functionality.

I wrote a Github Pages post for this


TLDR

On UNIX Try this:
(On Windows, read my Github Pages Post)

~/.ssh/scripts/check-host-fingerprint.sh

#!/bin/bash

fingerprints=$(ssh-keygen -lf <(ssh-keyscan $1 2>/dev/null))

for fingerprint in $fingerprints
do
        if [ "$fingerprint" == "$2" ]
        then
                exit 0
        fi
done

exit 1

~/.ssh/config


# Host with Global Fallback
Host my_auto_host
    User username
    Match host "my_auto_host" exec "/bin/bash %d/.ssh/scripts/check-host-fingerprint.sh 192.168.0.100 SHA256:12345678901234567890123456789012345678901234567"
        Hostname 192.168.0.100
        Port 22
    Hostname server.domain.org
    Port 1022

# Secondary Host using Primary as Proxy
Host secondary
    User u5ernam3
    Hostname 192.168.0.101
    Port 22
    ProxyJump my_auto_host

If this doesnt work for you, Please read my Github Pages post.
It it still doesn't work, feel free to contact me by email (can find on blog sidebar/footer).

added 6 characters in body
Source Link

This is a GREAT question, I always wondered too.

The short answer is No.. You cannot. So I decided to do it myself.

You can use script to get the the desired functionality.

I wrote a Github Pages post for this


TLDR

On UNIX Try this:
(On Windows, read my Github Pages Post)

~/.ssh/scripts/check-host-fingerprint.sh

#!/bin/bash

fingerprints=$(ssh-keygen -lf <(ssh-keyscan $1 2>/dev/null))

for fingerprint in $fingerprints
do
        if [ "$fingerprint" == "$2" ]
        then
                exit 0
        fi
done

exit 1

~/.ssh/config


# Host with Global Fallback
Host my_auto_host
    User username
    Match host "my_auto_host" exec "/bin/bash %d/.ssh/scripts/check-host-fingerprint.sh 192.168.0.100 SHA256:12345678901234567890123456789012345678901234567"
        Hostname 192.168.0.100
        Port 22
    Hostname server.domain.org
    Port 1022

# Secondary Host using Primary as Proxy
Host secondary
    User u5ernam3
    Hostname 192.168.0.101
    Port 22
    ProxyJump my_auto_host

If this doesnt work for you, Please read my Github Pages post.
It it still doesn't work, feel free to contact me by email (can find on forumblog sidebar/footer).

This is a GREAT question, I always wondered too.

The short answer is No.. You cannot. So I decided to do it myself.

You can use script to get the the desired functionality.

I wrote a Github Pages post for this


TLDR

On UNIX Try this:
(On Windows, read my Github Pages Post)

~/.ssh/scripts/check-host-fingerprint.sh

#!/bin/bash

fingerprints=$(ssh-keygen -lf <(ssh-keyscan $1 2>/dev/null))

for fingerprint in $fingerprints
do
        if [ "$fingerprint" == "$2" ]
        then
                exit 0
        fi
done

exit 1

~/.ssh/config


# Host with Global Fallback
Host my_auto_host
    User username
    Match host "my_auto_host" exec "/bin/bash %d/.ssh/scripts/check-host-fingerprint.sh 192.168.0.100 SHA256:12345678901234567890123456789012345678901234567"
        Hostname 192.168.0.100
        Port 22
    Hostname server.domain.org
    Port 1022

# Secondary Host using Primary as Proxy
Host secondary
    User u5ernam3
    Hostname 192.168.0.101
    Port 22
    ProxyJump my_auto_host

If this doesnt work for you, Please read my Github Pages post.
It it still doesn't work, feel free to contact me by email (can find on forum sidebar).

This is a GREAT question, I always wondered too.

The short answer is No.. You cannot. So I decided to do it myself.

You can use script to get the the desired functionality.

I wrote a Github Pages post for this


TLDR

On UNIX Try this:
(On Windows, read my Github Pages Post)

~/.ssh/scripts/check-host-fingerprint.sh

#!/bin/bash

fingerprints=$(ssh-keygen -lf <(ssh-keyscan $1 2>/dev/null))

for fingerprint in $fingerprints
do
        if [ "$fingerprint" == "$2" ]
        then
                exit 0
        fi
done

exit 1

~/.ssh/config


# Host with Global Fallback
Host my_auto_host
    User username
    Match host "my_auto_host" exec "/bin/bash %d/.ssh/scripts/check-host-fingerprint.sh 192.168.0.100 SHA256:12345678901234567890123456789012345678901234567"
        Hostname 192.168.0.100
        Port 22
    Hostname server.domain.org
    Port 1022

# Secondary Host using Primary as Proxy
Host secondary
    User u5ernam3
    Hostname 192.168.0.101
    Port 22
    ProxyJump my_auto_host

If this doesnt work for you, Please read my Github Pages post.
It it still doesn't work, feel free to contact me by email (can find on blog sidebar/footer).

Source Link
Loading