分类: 系统运维
2013-05-07 10:36:24
建立oracle的rac经常要建立相互认证,每次都是使用copy 和 paste来建立,很容易错误,自己写了一个简单的脚本,很容易完成这个工作,如下:
mkdir -p ~/.ssh
chmod 755 ~/.ssh
/usr/bin/ssh-keygen -t rsa
/usr/bin/ssh-keygen -t dsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
echo -n "wait another host $1 run finish, press twice key continue !!!"
read a
read a
ssh $1 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh $1 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
chmod 644 ~/.ssh/authorized_keys
# 命名脚本 为可执行
chmod 755 sshx
./sshx remote_ip
就可以了!