Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Linux Security»How to Disable Strict Host Key Checking in SSH

    How to Disable Strict Host Key Checking in SSH

    RahulBy RahulSeptember 20, 20212 Mins ReadUpdated:September 25, 2021

    The SSH server has default enabled the strict host key checking. When the key checking is enabled, the SSH client connects only those hosts, that valid host keys are stored in the known host’s file. You can find the fine at ~/.ssh/known_hosts.

    Once you are connected to a remote host file time via SSH, the SSH clients check for the host key file under the known_hosts file. If the key is found, you will be connected to a remote server after authentication, but if key doesn’t found in the known_hosts file, the command will show a warning message and a prompt to accept or reject the connection request. Once you accepted the by typing “yes”, the key is added in the known_hosts file.

    Here is an example to of command:

    ssh [email protected] 
    
    Output
    The authenticity of host 'remote-host (123.45.67.89)' can't be established. RSA key fingerprint is 9f:48:89:f5:68:2f:cd:b3:19:95:40:43:98:09:0a:1a. Are you sure you want to continue connecting (yes/no)?

    But in some situations, like shell scripts, we need to disable the strict host check. Continue to read this article to understand the way to disable strict host check in the SSH clients on Linux systems.

    Disable with SSH Command

    You can define the StrictHostKeyChecking=no command line argument to ssh command to skip the host key checking.

    ssh -o StrictHostKeyChecking=no [email protected] 
    

    Using Config File

    You can also define the strings to disable host key checking in the configuration file. You need to create a ~/.ssh/config file and disable strict host key checking by adding the content.

    vi ~/.ssh/config 
    
    Host *
        StrictHostKeyChecking no
    

    This will disable host checking for all hosts you connect to. Rather than disabling host check for all Host “*”, it would be safer to specify a particular host.

    Host 192.168.1.10
        StrictHostKeyChecking no
    

    Also, set the proper permissions on the file to make it read-only for the user.

    sudo chmod 400 ~/.ssh/config 
    

    That’s it. You have successfully disabled the strict host key checking in SSH.

    Conclusion

    In this tutorial, you have learned, how to disable strict host key check during ssh key connection to a remote host.

    SSH
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow To Install Node.Js on Debian 11
    Next Article How to Install Facebook Messenger on Ubuntu 21.04 & 20.04

    Related Posts

    (Resolved) userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms

    Updated:May 10, 20221 Min Read

    Adding a New SSH Key in GitHub

    Updated:April 1, 20223 Mins Read

    Top 10 Ethical Hacking Tools in Kali Linux

    Updated:April 6, 20228 Mins Read

    How to Create SFTP Only User in Debian 11

    Updated:September 26, 20214 Mins Read

    How To Set Up SSH Keys in Linux

    5 Mins Read

    How To Set Up SSH Tunneling

    5 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install Sublime Text 4 on Ubuntu 22.04
    • How to Enable / disable Firewall in Windows
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.