##1 安装ssh
###①安装openssh-server1
sudo apt-get install openssh-server
###①按照rsa方式生成密钥1
2ssh-keygen -t rsa -C "751440280@qq.com"
//邮箱输入自己的,仅作为标识
###②输入存储目录1
2/home/hadoop/.ssh/id_rsa
(默认就可以)
成功后如下:1
2
3The key fingerprint is:
2f:bb:13:23:66:09:34:29:be:57:db:93:69:f0:71:2a 751440280@qq.com
The key's randomart image is:
###③将id_rsa.pub追加到authorized_keys授权文件中1
2
3
4cd /home/hadoop/.ssh/
//默认文件夹
cat id_rsa.pub >> authorized_keys
1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5KYhnHzKZ8FY0zLrWr4rDlaTX3I9djdv9JC7hYouf/Hum3gfXhI18URqlQNdjF+K0Z79X/0elSvR4TKHfMwgHgm6o/5ifsWQLqLiuvh1vJTbFgy22LEOhfcKslssbGipxoHM90Jrz3buA9LMWq+Dhd6MP+V2eZbKwfTKdTMu1R3b4IJ7XOwifRaY6LYAd0ArLohTYRLTC4TwTmqB6kd9J1CjSxIE1umvlM0+y5cblmyWDkp9k2JtJldLaLSYD2jj8PFIw2YNHdTlMZwBoFkrLIMFMwvvRIYb3OR1+Rq/Cg3te7+opuE3IWyFGofYDDbq+P/JFTPHFbpd/bf+47tuj 751440280@qq.com |
###④测试是否能够登陆1
2ssh localhost
//输入yes 测试能否登陆。