您的位置:首页 > 其它

SSH免密码登陆

2016-07-29 17:51 357 查看
    

     在linux安装hadoop是为了以后操作方便可以进行免密码设置

       1 . 在Xshell 输入 cd 回到当前用户界面

        2  输入下面命令

        ssh-keygen -t rsa  "" 输入这个命令后一直回车就可以了

       [root@hadoop ~]# ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa): 

/root/.ssh/id_rsa already exists.

Overwrite (y/n)? y

Enter passphrase (empty for no passphrase): 

Enter same passphrase again: 

Your identification has been saved in /root/.ssh/id_rsa.

Your public key has been saved in /root/.ssh/id_rsa.pub.

The key fingerprint is:

b4:75:7a:87:6b:48:4a:48:39:e4:6c:a3:11:fe:ad:38 root@hadoop

The key's randomart image is:

+--[ RSA 2048]----+

|    . .          |

|   . = .         |

|    o O . . .    |

|     * * o o .   |

|    . o S o o .  |

|     . o o o o   |

|    E . . . o    |

|     .     .     |

|                 |

+-----------------+  

出现如上所示,基本上一直按enter

    2  将生成的公钥id_rsa.pub
内容追加到authorized_keys(执行命令:cat id_rsa.pub >> authorized_keys

       [root@hadoop ~]# cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

     安全起见,你可以退出linux再以root登陆进来一下,我是没做这个步骤
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: