1、下载安装sudo apt-get install ssh,若出现问题,可选择安装openssh-server,或ssh-server等
2、启动ssh,命令:sudo /etc/init.d/ssh start
3、查看是否启动,命令:ps -e|grep ssh
如果有sshd与ssh-agent则说明启动成功
4、生成密钥(公钥和私钥)
(先在主目录下生成文件夹.ssh)
ssh-keygen -t rsa -P '' -f ${主目录}/.ssh/id_rsa
5、将公钥id_rsa.pub重新入authorized_keys(需新建此文件)
cat id_rsa.pub >> ${主目录}/.ssh/authorized_keys
6、交换密钥,实现无密码登录(本机001,对机002)
将本机001的公钥id_rsa.pub拷到对机002上:scp id_rsa.pub 002:${主目录}/
7、002重复上面前5步
8、将002上从本机001拷贝过来id_rsa.pub追加到${002主目录}/.ssh/authorized_keys中,再把002上的authorized_keys拷到001的同目录下即可