SSH Without a Password(SSH无密码登录)

主要用于建立自己使用的cluster和个人PC之间的登录。

此外根据个人经验,SSH无密码登录在配置分布式系统(例如Hadoop和parallel databases)时往往都是第一个步骤。(除非配置的是单机盘,用IP地址处用localhost就可以搞定)。网上搜了集中方法,觉得这种方法是最好用的。


The following steps can be used to ssh from one system to another without specifying a password.

Notes:

Steps:

  1. On the client run the following commands:

    $ mkdir -p $HOME/.ssh
    $ chmod 0700 $HOME/.ssh
    $ ssh-keygen -t dsa -f $HOME/.ssh/id_dsa -P ''
    
    This should result in two files, $HOME/.ssh/id_dsa (private key) and $HOME/.ssh/id_dsa.pub (public key).
  2. Copy $HOME/.ssh/id_dsa.pub to the server.

  3. On the server run the following commands:

    $ cat id_dsa.pub >> $HOME/.ssh/authorized_keys2
    $ chmod 0600 $HOME/.ssh/authorized_keys2
    
    Depending on the version of OpenSSH the following commands may also be required:
    $ cat id_dsa.pub >> $HOME/.ssh/authorized_keys
    $ chmod 0600 $HOME/.ssh/authorized_keys
    
    An alternative is to create a link from authorized_keys2 to authorized_keys:
    $ cd $HOME/.ssh && ln -s authorized_keys2 authorized_keys
    
  4. On the client test the results by ssh'ing to the server:

    $ ssh -i $HOME/.ssh/id_dsa server
    
  5. (Optional) Add the following $HOME/.ssh/config on the client:

    Host server
             IdentityFile ~/.ssh/id_dsa
    
    This allows ssh access to the server without having to specify the path to the id_dsa file as an argument to ssh each time. 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值