原文地址:http://manjeetdahiya.com/2011/03/03/passwordless-ssh-login/

Consider two machines A and B. We want to connect machine B from A over SSH. To do so we have to specify password every time we connect. Here, we can create a setup where SSHing can be done without the password prompt.  On connecting machine B from A, ssh won’t ask for password.

Overview of Setup

  • Generate public and private encryption keys on machine A.
  • Authorize machine A in machine B by appending the public key of A in the file authorized_keysof machine B.

That’s it! You can now access (SSH) machine B from A without specifying the password. B has been now authorized to access A without requiring the password.

Detailed Steps

Method 1

  • Login to machine A and execute the following command:

    1
    ssh-keygen && ssh-copy-id -i user@B

    The first command generates keys. It will ask for path of the keys and passphrase. Hit Enter key repeatedly to choose the default values.
    The second command adds generated key to B. It will ask for password of user at machine B. And this would be the last time!

Method 2

    • Login to machine A.
    • Generate public and private keys like following:
      1
      ssh-keygen -t dsa

      It will ask for path of the keys and passphrase. Choose the default path and no password.
      This will generate files id_dsa.pub and id_dsa in ~/.ssh

    • Browse for the above generated keys and copy the public key, that is id_dsa.pub, to the machine B.
    • Login to machine B.
    • Append the public key of A to the file authorized_keys:
      1
      cat id_dsa.pub >> .ssh/authorized_keys

      Note: Create the directory .ssh in your home if it doesn’t exist.
      You can now delete id_dsa.pub from machine B if you want to.

    • Make sure of the permissions of the directory .ssh and the file authorized_keys are read-write only by the targetted user. Otherwise it might not work.
      1
      2
      chmod 700 .ssh
      chmod 600 .ssh/authorized_keys
    • Now go back to machine A and SSH machine B. It should not ask for the password.

Passwordless SSH Login的更多相关文章

  1. Oracle 11g RAC INS-06006 Passwordless SSH connectivity not set up between the following node(s)

    安装11g RAC的grid时,在Test互信的时候报错INS-06006 Passwordless SSH connectivity not set up between the following ...

  2. Fixing ssh login long delay

    原文:http://injustfiveminutes.com/2013/03/13/fixing-ssh-login-long-delay/ For a long time I had a prob ...

  3. [INS-06006] Passwordless SSH connectivity not set up between the following node(s)

    解决方法1 参考:11.2.0.4 runInstaller: [INS-06006] Passwordless SSH connectivity not set up between the fol ...

  4. SSH login without password

    SSH login without password Your aim You want to use Linux and OpenSSH to automize your tasks. Theref ...

  5. Security configuration of SSH login entry - enterprise security practice

    catalog . 引言 . 修改ssh端口 . 禁用root远程ssh登录 . 只使用SSH v2 . 限制用户的SSH访问 . 禁用.rhosts文件 . 禁用基于主机的身份验证 . 基于公私钥的 ...

  6. ssh login nova vm

    $ sudo cat >> /usr/bin/nova-ssh  << END FIRST=$1 IDX=`expr index $1 "@"`if [[ ...

  7. 3 Steps to Perform SSH Login Without Password Using ssh-keygen & ssh-copy-id

    http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-s ...

  8. 【转载】SSH login without password 免密登陆

    Your aim You want to use Linux and OpenSSH to automate your tasks. Therefore you need an automatic l ...

  9. putty ssh login linux

    (1) in linux $ ssh-keygen -t dsa $ cd .ssh $ cat id_dsa.pub > authorized_keys $ chmod 600 authori ...

随机推荐

  1. 【Android测试】【随笔】性能采集工具——小松鼠诞生记

    ◆版权声明:本文出自胖喵~的博客,转载必须注明出处. 转载请注明出处:http://www.cnblogs.com/by-dream/p/4945066.html 起因 去年刚加入TX的时候,我便接手 ...

  2. win7电脑共享VPN连接教程

    互通网络VPN服务器不限制连接数,如果仅仅是电脑连接的话有点浪费,如何只在笔记本电脑上设置一次VPN,然后手机.平板等都可以直接共享使用呢?为什么需要笔记本电脑,因为笔记本电脑内置的无线网卡可以设置w ...

  3. NOIP2011 题解

    铺地毯 题解:比大小 #include <cstdio> +; int n, x, y, a[MAXN], b[MAXN], g[MAXN], k[MAXN]; inline int So ...

  4. [Leetcode][JAVA] Word Ladder II

    Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from ...

  5. 关于Yaf的一些说明[转Yaf作者]

    关于Yaf的一些说明[转Yaf作者] 说明下,这篇文章转至于yaf作者鸟哥的博文,因为最近在系统的学习Yaf框架,发现了这篇文章,感觉对于了解Yaf框架还是很有用处,所以转过来和大家分享一下 Yaf是 ...

  6. 在Ubuntu全局安装express报错:Error: EACCES, mkdir '/usr/lib/node_modules/express'的解决办法

    $ npm install -g express npm ERR! Error: EACCES, mkdir '/usr/lib/node_modules/express' npm ERR! { [E ...

  7. 腾讯DBA官方博客开通了,欢迎交流

    腾讯DBA官方博客开通了,欢迎交流哈..麻烦给放到首页一下     http://tencentdba.com   腾讯互娱游戏DBA团队一直致力于为游戏提供稳定.高效的DB运营服务,这是我们团队的使 ...

  8. iOS UIWebView中javascript与Objective-C交互、获取摄像头

    UIWebView是iOS开发中常用的一个视图控件,多数情况下,它被用来显示HTML格式的内容. 支持的文档格式 除了HTML以外,UIWebView还支持iWork, Office等文档格式: Ex ...

  9. Ember.js系列文章

    JS前端框架之Ember.js系列文章 本文为文章索引,主要是罗列Ember.js的相关文章便于阅读. 相关演示代码:github for free. 基础篇 1. EmberJs之What|Why| ...

  10. Gradle命令行黑魔法

    毫无疑问,现在Gradle已经成为java世界最火的构建工具,风头已经盖过了冗余的ant,落后的maven.Gradle是以Groovy语言编写的一套构建脚本的DSL,由于Groovy语法的优雅,所以 ...