add: signle trust script between OMC and NF
This commit is contained in:
23
misc/sshcpid.sh
Normal file
23
misc/sshcpid.sh
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 判断id_rsa密钥文件是否存在
|
||||||
|
if [ ! -f ~/.ssh/id_rsa ];then
|
||||||
|
ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa
|
||||||
|
else
|
||||||
|
echo "id_rsa has created ..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
ip=$1
|
||||||
|
user=$2
|
||||||
|
passwd=$3
|
||||||
|
|
||||||
|
#分发到$ip主机.
|
||||||
|
expect <<EOF
|
||||||
|
set timeout 10
|
||||||
|
spawn ssh-copy-id -f $user@$ip
|
||||||
|
expect {
|
||||||
|
"yes/no" { send "yes\n";exp_continue }
|
||||||
|
"password" { send "$passwd\n" }
|
||||||
|
}
|
||||||
|
expect "password" { send "$passwd\n" }
|
||||||
|
EOF
|
||||||
Reference in New Issue
Block a user