{"id":497,"date":"2018-10-17T14:49:23","date_gmt":"2018-10-17T14:49:23","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=497"},"modified":"2018-10-17T15:53:39","modified_gmt":"2018-10-17T15:53:39","slug":"linux-for-freshers-how-do-i-login-over-ssh-without-using-password-less-rsa","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/17\/linux-for-freshers-how-do-i-login-over-ssh-without-using-password-less-rsa\/","title":{"rendered":"Linux for freshers: How do I login over ssh without using password less RSA"},"content":{"rendered":"<p>Linux system Admins normally login to the linux servers either supplying a password, or using keybased authentication. sshpass is a tool which allows us to automatically supply password to the command prompt so that automated scripts can be run as desired by users. sshpass supplies password to ssh prompt using dedicated tty , fooling ssh to believe that a interactive user is supplying password.<\/p>\n<h2>Install sshpass under Debian \/ Ubuntu Linux<\/h2>\n<p>Type the following command:<\/p>\n<p>$ sudo apt-get install sshpass<b><\/b><\/p>\n<h2>Install sshpass under RHEL\/CentOS Linux<\/h2>\n<p>$ sudo yum install sshpass<\/p>\n<p>If you are using Fedora Linux, type:<\/p>\n<p>$ sudo dnf install sshpass<\/p>\n<h2>Install sshpass under Arch Linux<\/h2>\n<p>$ sudo pacman -S sshpass<\/p>\n<h2>Install sshpass under OpenSUSE Linux<\/h2>\n<p>$ sudo zypper install sshpass<\/p>\n<h2>Install sshpass under FreeBSD Unix<\/h2>\n<p>To install the port, enter:<\/p>\n<p># cd \/usr\/ports\/security\/sshpass\/ &amp;&amp; make install clean<\/p>\n<p>To add the package, run:<\/p>\n<p># pkg install sshpass<b><\/b><\/p>\n<p>Getting Help :<\/p>\n<p># sshpass -h<\/p>\n<p>Usage: sshpass [-f|-d|-p|-e] [-hV] command parameters<\/p>\n<ul>\n<li>-f filename Take password to use from file<\/li>\n<li>-d number Use number as file descriptor for getting password<\/li>\n<li>-p password Provide password as argument (security unwise)<\/li>\n<li>-e Password is passed as env-var &#8220;SSHPASS&#8221; With no parameters \u2013 password will be taken from stdin<\/li>\n<li>-h Show help (this screen)<\/li>\n<li>-V Print version information<\/li>\n<\/ul>\n<p>At most one of -f, -d, -p or -e should be used<b><\/b><\/p>\n<h2>How do I use sshpass in Linux or Unix?<\/h2>\n<p>Login to ssh server called example.com with password called redhat@1234<\/p>\n<p>$ sshpass -p &#8216;redhat@1234&#8217; ssh username@example.com<\/p>\n<p>For shell script you may need to disable host key checking:<\/p>\n<p>$ sshpass -p &#8216;redhat@1234&#8217; ssh -o StrictHostKeyChecking=no username@example.com<\/p>\n<p>TO RUN SOME COMMAND ON THE REMOTE SERVER TO CHECKING UPTIME<\/p>\n<p>$sshpass -p &#8216;redhat@1234&#8217; ssh username@example.com &#8220;uptime&#8221;<\/p>\n<p>Sample output<\/p>\n<p>01:04:35 up 126 days, 3:34, 2 users, load average: 0.50, 0.54, 0.55<\/p>\n<h2>Reading password from file<\/h2>\n<p>Another option is to read password from file using the -f option.<\/p>\n<p>The syntax is:<\/p>\n<p>sshpass -f fileNameHere ssh user@server<\/p>\n<p><a href=\"https:\/\/www.linuxforfreshers.com\/2018\/06\/how-do-i-login-over-ssh-without-using.html\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux system Admins normally login to the linux servers either supplying a password, or using keybased authentication. sshpass is a tool which allows us to automatically supply password to the command prompt so that automated scripts can be run as desired by users. sshpass supplies password to ssh prompt using dedicated tty , fooling ssh &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/17\/linux-for-freshers-how-do-i-login-over-ssh-without-using-password-less-rsa\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Linux for freshers: How do I login over ssh without using password less RSA&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-497","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/497","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=497"}],"version-history":[{"count":2,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/497\/revisions"}],"predecessor-version":[{"id":540,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/497\/revisions\/540"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=497"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}