{"id":4,"date":"2010-04-25T22:25:35","date_gmt":"2010-04-26T02:25:35","guid":{"rendered":"http:\/\/www.xavignu.com\/?p=4"},"modified":"2010-04-27T15:48:49","modified_gmt":"2010-04-27T19:48:49","slug":"setting-passwordless-ssh-trust","status":"publish","type":"post","link":"https:\/\/www.xavignu.com\/?p=4","title":{"rendered":"Setting passwordless ssh trust"},"content":{"rendered":"<p>I&#8217;m going to explain how to set ssh trust between two hosts. This would allow us to connect to the server without having to type the password.<\/p>\n<p>1) First generate the public and private keys on the machine from where you want to log in to other machines. This can be accomplished in two ways depending on the ssh version running on the server you want to log in. I recommend using ssh version 2. Ssh version 1 has security flaws.<\/p>\n<p>Type from the command line:<\/p>\n<p># <strong>ssh-keygen -t dsa<\/strong><br \/>\nGenerating public\/private dsa key pair.<br \/>\nEnter file in which to save the key (\/home\/user\/.ssh\/id_dsa):<br \/>\nEnter passphrase (empty for no passphrase):<br \/>\nEnter same passphrase again:<br \/>\nYour identification has been saved in \/home\/user\/.ssh\/id_dsa.<br \/>\nYour public key has been saved in \/home\/user\/.ssh\/id_dsa.pub.<br \/>\nThe key fingerprint is:<br \/>\n86:40:27:c5:29:ce:64:35:1f:a9:b9:9c:f0:97:a5:4d user@server<br \/>\nThe key&#8217;s randomart image is:<br \/>\n+&#8211;[ DSA 1024]&#8212;-+<br \/>\n|\u00a0\u00a0\u00a0 o+=&#8230;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n|\u00a0\u00a0 .+ooo..\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n|\u00a0\u00a0 =.. o.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n|\u00a0\u00a0\u00a0 +.o.\u00a0 E\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n|\u00a0\u00a0\u00a0\u00a0 +.oS*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n|\u00a0\u00a0\u00a0\u00a0\u00a0 =.+ .\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n|\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 .\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n|\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n|\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n#<\/p>\n<p>This will generate a public and a private key in the ~\/.ssh directory. Don&#8217;t type anything when asked for the passphrase. Now we need to copy the public key to the server we want to log in passwordless.<\/p>\n<p>2) Type the following.<\/p>\n<p># <strong>scp ~\/.ssh\/id_dsa.pub user@remote_server:\/tmp<\/strong><\/p>\n<p>3) Log into the remote server and copy the public key to the authorized_keys file in the ~\/.ssh directory.<\/p>\n<p>remote_server# <strong>cat \/tmp\/id_dsa.pub &gt;&gt; ~\/.ssh\/authorized_keys<\/strong><\/p>\n<p>That&#8217;s it. You are done. Enjoy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post explains how to create trust between two servers allowing password login to one server.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[3],"tags":[6,7],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/pTQgt-4","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.xavignu.com\/index.php?rest_route=\/wp\/v2\/posts\/4"}],"collection":[{"href":"https:\/\/www.xavignu.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xavignu.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xavignu.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xavignu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4"}],"version-history":[{"count":0,"href":"https:\/\/www.xavignu.com\/index.php?rest_route=\/wp\/v2\/posts\/4\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.xavignu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xavignu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xavignu.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}