While running a script to login to multiple remote servers using sshpass (or) keybased authentication (or) while logging to remote server using ssh (or) while copying the file using SCP.
There are chances we might have encountered this "Host Key Verification failed" message.
All the time we cannot do manual ssh and click yes to add the host key into ~/ssh/known_hosts file.
Here is some alternative trick that helps.
Just use these flags in scp and ssh to get rid of this messages.
SSH
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no [email protected]
SCP
scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no somefile.txt [email protected]:/var/tmp/
Hope this helps!
Cheers
A K S A R A V
More from Middleware Inventory
-
How to create ssh public key from private key - Vagrant & LinuxHow to create SSH public Key from SSH private key is a question made me write this post. Though we would be able to achieve the SSH key-based authentication by producing the private key. Sometimes it is necessary that we must have the SSH public key. Especially when we are…
-
How to enable SSH Key based authentication - Passwordless SSHHow to SSH without Password into remote Linux Server is the question that every Engineer working on Linux might have come across. Sometimes the Question we seek could be different like ssh command without password ssh to the remote server without password SSH without password from Shell Script SCP to…
-
Vagrant Private key - Ansible SSH Permission Denied - How to resolve.While building VMs with Vagrant and trying to run ansible-playbook with them over SSH connection. We get exceptions like Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password The execution and the error would like something similar to the below. This post presumes that you are using the…
-
Ansible SSH Key transfer from one host to another - local and remoteSSH Key-based authentication setup in LINUX (or) UNIX based OS is one of the major platform services related task and most frequently executed task by Unix admins. Ansible, An IT Automation tool could automate this tedious task as well. SSH Key based authentication is indispensable when it comes to automation. Even…
-
Docker SSH Into the Container - How to SSH to ContainerThe Docker container is a Process and Not a Virtual Machine. So You do not need any protocol like SSH to get into the container Shell. Docker CLI has given us special commands to get into the Container like docker exec -it and docker run -it In this post, we…