linux下取消ssh密码输入

假设有两台机器:client和server,client希望ssh登录server端时,不输入密码

1. 生成client端ssh密钥对,包括公钥id_rsa.pub和私钥id_rsa

  ssh-keygen -P "" -trsa1 -f ~/.ssh/id_rsa

  -p:需要输入的密码

  -f:指定密钥文件

2. 修改client端ssh配置文件/etc/ssh/ssh_config

  Host *

    ForwardX11 yes

    IdentityFile ~/.ssh/id_rsa

    Protocol 2,1

3. 重启client端的sshd服务

  /etc/rc.d/init.d/sshd restart

4. 将client端的公钥id_isa.put拷贝到server端的/root/.ssh/下,并命名为authorized_keys

5. 改变密钥权限

  chmod +x 600 /root/.ssh/id_isa.put

  chmod +x 600 /root/.ssh/id_isa

  chmod +x 600 /root/.ssh/authorized_keys

posted on 2010-08-11 16:49  lambda107  阅读(1310)  评论(0编辑  收藏  举报

导航