原文地址: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. centos6搭建VPN

    1,检查是否开启PPP #cat /dev/ppp cat: /dev/ppp: No such device or address //表示已经开启 2,安装ppp和iptables #yum in ...

  2. HTTP请求响应对照表

    1)请求(客户端->服务端[request]) GET(请求的方式) /books/java.html(请求的目标资源) HTTP/1.1(请求采用的协议和版本号) Accept: */*(客户 ...

  3. 使用my exclipse对数据库进行操作(1)

    一.查找 public class class1 { public static void main(String[] args) { // TODO Auto-generated method st ...

  4. JS手机端去除默认自带的选择复制菜单

    在需要的div上添加以下控制-webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: ...

  5. [转]关闭ORACLE数据库

    SQL> shutdown immediateORA-24324: 未初始化服务句柄ORA-24323: 不允许此值ORA-01090: 正在关闭 - 不允许连接 SQL> shutdow ...

  6. Robots on a grid(DP+bfs())

    链接:http://www.bnuoj.com/bnuoj/problem_show.php?pid=25585 Current Server Time: 2013-08-27 20:42:26 Ro ...

  7. 【书海】《Head First Java》 ——读后总结

    <Head First Java> 中文版 (第二版) IT`huhui前言录 <Head First Java>这本书我不算特别细的看了一遍.认为十分适合初学者,甚至是没接触 ...

  8. java环境配置笔记

    1.使用Eclipse,要安装jdk,jdk现在可用1.7版本 2.打开Eclipse,配置maven,打开window-preferencess,在maven-user settings处,设置ma ...

  9. 导入HDFS的数据到Hive

    1. 通过Hive view CREATE EXTERNAL TABLE if not exists finance.json_serde_optd_table ( retCode string, r ...

  10. 在Debian下编译Postgresql

    今天起床看到床头上的那本<PostgreSQL数据库内核分析>,发觉这书买了这么长时间,虽然大致看了一遍,可还没亲手实践.今天就花了点时间搭了个调试环境. 环境:Debian 7.0 ## ...