{"id":6702,"date":"2021-12-02T14:50:37","date_gmt":"2021-12-02T14:50:37","guid":{"rendered":"https:\/\/hengowebsite.luong.fr\/?page_id=6702"},"modified":"2021-12-02T14:53:41","modified_gmt":"2021-12-02T14:53:41","slug":"sshpass-ubuntu","status":"publish","type":"page","link":"https:\/\/hengowebsite.luong.fr\/?page_id=6702","title":{"rendered":"Sshpass Ubuntu"},"content":{"rendered":"<h1 style=\"text-align: left;\">OpenSSH : Use SSHPass<\/h1>\n<div class=\"block\">Use SSHPass to automate inputting password on password authentication.<\/div>\n<div class=\"block\">This is convenient but it has security risks (leak of password), take special care if you use it.<\/div>\n<h2>Install SSHPass.<\/h2>\n<p>root@dlp:~# &nbsp;<em><strong><a href=\"https:\/\/www.server-world.info\/en\/command\/html\/apt.html\">apt<\/a> -y install sshpass<\/strong><\/em><\/p>\n<h2>How to use SSHPass.<\/h2>\n<div class=\"block\">\n<div class=\"color2\"># [-p password] : from argument<\/div>\n<div class=\"color2\"># if initial connection, add [StrictHostKeyChecking=no]<\/div>\n<p>ubuntu@# <em><strong>sshpass -p password ssh -o StrictHostKeyChecking=no 10.0.0.51 hostname<\/strong><\/em><br \/>\nnode01.srv.world<\/p>\n<\/div>\n<div class=\"block\">\n<div class=\"color2\"># [-f file] : from file<\/div>\n<p>ubuntu@dlp:~$<em><strong> <a href=\"https:\/\/www.server-world.info\/en\/command\/html\/echo.html\">echo<\/a> &lsquo;password&rsquo; &gt; sshpass.txt<\/strong><\/em><br \/>\nubuntu@dlp:~$ <a href=\"https:\/\/www.server-world.info\/en\/command\/html\/chmod.html\"><strong><em>chmod<\/em><\/strong><\/a><strong><em> 600 sshpass.txt<\/em><\/strong><br \/>\nubuntu@dlp:~$ s<em><strong>shpass -f sshpass.txt ssh 10.0.0.51 hostnam<\/strong><\/em>e<br \/>\nnode01.srv.world<\/p>\n<\/div>\n<div class=\"color2\"># [-e] : from environment variable<\/div>\n<div class=\"color2\">ubuntu@dlp:~$ <em><strong>export SSHPASS=password<\/strong><\/em><\/div>\n<div class=\"color2\">ubuntu@dlp:~$ <em><strong>sshpass -e ssh 10.0.0.51 hostname node01.srv.world<\/strong> <\/em><\/div>\n","protected":false},"excerpt":{"rendered":"<p>OpenSSH : Use SSHPass Use SSHPass to automate inputting password on password authentication. This is convenient but it has security risks (leak of password), take special care if you use it. Install SSHPass. root@dlp:~# &nbsp;apt -y install sshpass How to use SSHPass. # [-p password] : from argument # if initial connection, add [StrictHostKeyChecking=no] ubuntu@# [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ngg_post_thumbnail":0},"_links":{"self":[{"href":"https:\/\/hengowebsite.luong.fr\/index.php?rest_route=\/wp\/v2\/pages\/6702"}],"collection":[{"href":"https:\/\/hengowebsite.luong.fr\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/hengowebsite.luong.fr\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/hengowebsite.luong.fr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hengowebsite.luong.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6702"}],"version-history":[{"count":2,"href":"https:\/\/hengowebsite.luong.fr\/index.php?rest_route=\/wp\/v2\/pages\/6702\/revisions"}],"predecessor-version":[{"id":6705,"href":"https:\/\/hengowebsite.luong.fr\/index.php?rest_route=\/wp\/v2\/pages\/6702\/revisions\/6705"}],"wp:attachment":[{"href":"https:\/\/hengowebsite.luong.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}