how to suppress message when ssh to host "Are you sure you want to continue connecting (yes/no)? yes"???????

how can I suppress this message when ssh into a linux server , i cant seem to find this like no check or something ,


ECDSA key fingerprint is MD5:de:66:6wea:32:dw2:65:d7wwwwwww:1c:a4:05:e0.
Are you sure you want to continue connecting (yes/no)? yes
LVL 1
NAMEWITHELD12Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott SilvaNetwork AdministratorCommented:
Set StrictHostKeyChecking no in your /etc/ssh/ssh_config file, where it will be a global option used by every user on the server. Or set it in your ~/.ssh/config file, where it will be the default for only the current user. Or you can use it on the command line:

ssh -o StrictHostKeyChecking=no -l $user $host
0
nociSoftware EngineerCommented:
Otoh, the question has a reason, you could f.e. connect to to the wrong computer giving out your credentials..
This question allows you to check if you got to the right place. And if you say Yes, the ID of the system wil be remembered in to future.

So per host this question is only asked once .... unless the stored credentials are removed.
0
serialbandCommented:
When I used to manage multiple online unix/linux systems, I published the hostids for users to manually load into ~/.ssh/known_hosts and avoid being asked.  Unfortunately, I doubt that most users even understood.  Loading it into the known_hosts file will prevent the popup.

It's not recommended to suppress the message.  You use it to identify and verify that the system you're connecting to is the correct one.
1
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

NAMEWITHELD12Author Commented:
this is for ansible to connect to each host , I think the more secure and professional way to do this is to add the hosts to the known hosts file
1
serialbandCommented:
Usually, you only have to be asked once.  The host ID will be loaded into your system.  If you meant that you will do it from multiple systems, then you could manually connect to all the systems from the one you're using, then copy the known_hosts file to the other systems.
0
murugesandinsShell_script Automation /bin/bash /bin/bash.exe /bin/ksh /bin/mksh.exe AIX C C++ CYGWIN_NT HP-UX Linux MINGW32 MINGW64 SunOS Windows_NTCommented:
@NAMEWITHELD12
Here goes the reason behind /usr/bin/ssh and ~/.ssh/known_hosts file:
>> Are you sure you want to continue connecting (yes/no)? yes
$ /bin/rm -i ~/.ssh/known_hosts
/bin/rm: remove regular file '/home/murugesandins/.ssh/known_hosts'? y

Open in new window

After removing this file using /usr/bin/ssh localhost
$ /bin/ls -l ~/.ssh/known_hosts
/bin/ls: cannot access '/home/murugesandins/.ssh/known_hosts': No such file or directory
$ /usr/bin/ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ECDSA key fingerprint is SHA256:ODeaQmZm2pvpJkXMDDuiQEhFIXPeEy/ejs1jnsaVmG4.
Are you sure you want to continue connecting (yes/no)? yes
$ /usr/bin/ssh -q localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ECDSA key fingerprint is SHA256:ODeaQmZm2pvpJkXMDDuiQEhFIXPeEy/ejs1jnsaVmG4.
Are you sure you want to continue connecting (yes/no)? yes
murugesandins@localhost's password:
No mail.
Last login: Fri Mar 16 18:18:02 2018 from 127.0.0.1
$ exit
$ /bin/ls -l ~/.ssh/known_hosts
-rw-r--r-- 1 murugesandins murugesandins 222 Mar 16 18:18 /home/murugesandins/.ssh/known_hosts

Open in new window

Hence when current system connecting to other system, /usr/bin/ssh is adding known host to ~/.ssh/known_hosts
If you reconnect again, /usr/bin/ssh used to verify if that host is trusted host or not
by reading ~/.ssh/known_hosts
if trusted, it won't ask again:
$ /usr/bin/ssh -q localhost
murugesandins@localhost's password:
No mail.
Last login: Fri Mar 16 18:18:13 2018 from 127.0.0.1
$ exit

Open in new window

If you are using /usr/bin/ssh ip address instead of /usr/bin/ssh hostname
{
          ip address used to change because of using dhcp.
          In that case, ~/.ssh/known_hosts file needs to be updated each time when ip address are changed.
}
Hence handled those exceptions.
This is good for security and informing the clients, about (ssh/sshd/ssl/...) secure policies :)
~/.ssh/known_hosts file used to have related type of public key from ( /usr/bin/ssh or  /usr/bin/sftp or ... secure related protocols )
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.