title: Can I automate ssh connection? ssh user@server.company.com
body: <p>I want to create a script that inserting a new connection to my <code>known_hosts</code> file.</p>
  
  <p>When I want to add a new server to the known_hosts file I manually use this command:</p>
  
  <pre><code>ssh user@server.company.com
  </code></pre>
  
  <p>Then I get this in return:</p>
  
  <pre><code>The authenticity of host 'server.company.com (XX.34.228.XXX)' can't be established.
  ECDSA key fingerprint is 78:eb:28:7c:a6:19:4f:28:48:ab:0d:c6:e4:4e:dc:ff.
  Are you sure you want to continue connecting (yes/no)?
  </code></pre>
  
  <p>when answering 'yes'</p>
  
  <p>I get this in return:</p>
  
  <blockquote>
    <p>Warning: Permanently added 'server.company.com XX.34.228.XXX' (ECDSA)
    to the list of known hosts. user@server.company.com's password:</p>
  </blockquote>
  
  <p>After printing the password - I'm connected to the remote server.</p>
  
  <p>The next time I would like to connect, I won't be needing to insert the password again.</p>
  
  <p>Is there a way to automate this process using a shell script?
  I tried all those options with no luck:</p>
  
  <pre><code>yes | ssh user@server.company.com
  
  echo yes | ssh user@server.company.com
  </code></pre>
  
  <p>but nothing works</p>