ssh 无密码登录要使用公钥与私钥。linux下可以用用ssh-keygen生成公钥/私钥对,下面我以CentOS为例。 [chenlb@A ~]$ ssh-keygen -t rsa -P ''
[chenlb@A ~]$ scp .ssh/id_rsa.pub chenlb@192.168.1.181:/home/chenlb/id_rsa.pub
chenlb@192.168.1.181's password: id_rsa.pub 100% 223 0.2KB/s 00:00
[chenlb@B ~]$ cat id_rsa.pub >> .ssh/authorized_keys
[chenlb@B ~]$ chmod 600 .ssh/authorized_keys
[chenlb@A ~]$ ssh 192.168.1.181
The authenticity of host '192.168.1.181 (192.168.1.181)' can't be established. RSA key fingerprint is 00:a6:a8:87:eb:c7:40:10:39:cc:a0:eb:50:d9:6a:5b. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.1.181' (RSA) to the list of known hosts. Last login: Thu Jul 3 09:53:18 2008 from chenlb [chenlb@B ~]$
|
|