SSH免密码

主节点上生成密钥对,分发到各个节点上去

  • 在主节点上执行ssh-keygen -t rsa一路回车,生成无密码的密钥对。
    ssh-keygen -t rsa
  • 将公钥添加到认证文件中
    cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
  • 设置authorized_keys的访问权限
    chmod 600 ~/.ssh/authorized_keys
  • scp文件到所有datenode节点
    scp ~/.ssh/authorized_keys root@node1:~/.ssh/
    scp ~/.ssh/authorized_keys root@node2:~/.ssh/
    scp ~/.ssh/authorized_keys root@noden:~/.ssh/
  • 监测
    ssh node1
    ssh node2
    ssh noden

另外一种方式
ssh-keygen -t rsa -C "zk2"
ssh-copy-id root@zk1

http://blog.csdn.net/u013066244/article/details/52796341

其它方式

ssh-keygen -t rsa -f ~/.ssh/id_rsa -P '' && \ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

vi ~/.ssh/config

Host localhost
  StrictHostKeyChecking no

Host 0.0.0.0
  StrictHostKeyChecking no
  
Host ourdark*
   StrictHostKeyChecking no
   UserKnownHostsFile=/dev/null