Skip to main content

SSH (ssh and other programs that run it, such as scp and sftp) stores its keys in ~/.ssh/known_keysknown_hosts by default. It identifies hosts by their keys.

In this case, you presumably have one of those keys (ECDSA or RSA) stored in that file and your SSH configuration (~/.ssh/config or else the system-wide copy in /etc/ssh/ssh_config or a similar location) is using StrictHostKeyChecking (see its entry in ssh_config(5)).

When you connect to the other one, run it like this (correct the key algorithm if I guessed it wrong):

sftp -v -o HostKeyAlgorithms=rsa-sha2-256 -o StrictHostKeyChecking=ask test-user@localhost

Ask is the default for this setting. With it enabled, you should then be prompted to save the second key. You won't need it in subsequent connections since both keys will be saved.

SSH (ssh and other programs that run it, such as scp and sftp) stores its keys in ~/.ssh/known_keys by default. It identifies hosts by their keys.

In this case, you presumably have one of those keys (ECDSA or RSA) stored in that file and your SSH configuration (~/.ssh/config or else the system-wide copy in /etc/ssh/ssh_config or a similar location) is using StrictHostKeyChecking (see its entry in ssh_config(5)).

When you connect to the other one, run it like this (correct the key algorithm if I guessed it wrong):

sftp -v -o HostKeyAlgorithms=rsa-sha2-256 -o StrictHostKeyChecking=ask test-user@localhost

Ask is the default for this setting. With it enabled, you should then be prompted to save the second key. You won't need it in subsequent connections since both keys will be saved.

SSH (ssh and other programs that run it, such as scp and sftp) stores its keys in ~/.ssh/known_hosts by default. It identifies hosts by their keys.

In this case, you presumably have one of those keys (ECDSA or RSA) stored in that file and your SSH configuration (~/.ssh/config or else the system-wide copy in /etc/ssh/ssh_config or a similar location) is using StrictHostKeyChecking (see its entry in ssh_config(5)).

When you connect to the other one, run it like this (correct the key algorithm if I guessed it wrong):

sftp -v -o HostKeyAlgorithms=rsa-sha2-256 -o StrictHostKeyChecking=ask test-user@localhost

Ask is the default for this setting. With it enabled, you should then be prompted to save the second key. You won't need it in subsequent connections since both keys will be saved.

Source Link
Adam Katz
  • 12.1k
  • 2
  • 27
  • 50

SSH (ssh and other programs that run it, such as scp and sftp) stores its keys in ~/.ssh/known_keys by default. It identifies hosts by their keys.

In this case, you presumably have one of those keys (ECDSA or RSA) stored in that file and your SSH configuration (~/.ssh/config or else the system-wide copy in /etc/ssh/ssh_config or a similar location) is using StrictHostKeyChecking (see its entry in ssh_config(5)).

When you connect to the other one, run it like this (correct the key algorithm if I guessed it wrong):

sftp -v -o HostKeyAlgorithms=rsa-sha2-256 -o StrictHostKeyChecking=ask test-user@localhost

Ask is the default for this setting. With it enabled, you should then be prompted to save the second key. You won't need it in subsequent connections since both keys will be saved.