Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1380349
  • 博文数量: 77
  • 博客积分: 2104
  • 博客等级: 大尉
  • 技术积分: 2322
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-19 13:21
个人简介

关注于系统高可用、网站架构

文章分类

全部博文(77)

文章存档

2018年(1)

2017年(1)

2015年(4)

2014年(8)

2013年(4)

2012年(12)

2011年(17)

2010年(30)

分类: LINUX

2010-09-09 17:25:37

发现一个ssh-copy-id命令很容易实现
[root@localhost .ssh]# ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
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:
bf:2c:2a:5a:8c:4d:d1:3c:b4:b8:74:27:ca:0c:20:25 root@localhost
 
[root@localhost ~]# ssh-copy-id -i .ssh/id_rsa.pub  root@10.10.31.16
15
root@10.10.31.16's password: 
Now try logging into the machine, with "ssh 'root@10.10.31.16'", and check in:
  .ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.


使用ssh-agent + keychain:

1. ssh-agent代理
eval `ssh-agent` # 两个反引号

2. 添加ssh-add
ssh-add
Enter passphrase for /home/linux/.ssh/id_dsa: #(输入密码)

3、yum install keychain

4、$ vim $HOME/.ssh/config
StrictHostKeyChecking no

5、cat > .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
export PSSH_OPTIONS="StrictHostKeyChecking=no"
eval `keychain --eval --agents ssh id_rsa`
阅读(1887) | 评论(0) | 转发(0) |
0

上一篇:lvs安装

下一篇:openldap常用命令

给主人留下些什么吧!~~