-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathauto.sh
More file actions
executable file
·50 lines (42 loc) · 1.09 KB
/
auto.sh
File metadata and controls
executable file
·50 lines (42 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
#****************************************************************#
# ScriptName: function.sh
# Author: [email protected]
# Create Date: 2015-05-06 22:15
# Modify Author: [email protected]
# Modify Date: 2015-06-02 19:33
# Function:
#***************************************************************#
pass="roottoor"
auto_ssh_copy_id(){
expect -c "set timeout 10;
spawn ssh-copy-id $1;
expect *assword:*;
send -- $pass\r;
interact;";
}
#for i in `cat $1`
#do
# auto_ssh_copy_id $i
#done
auto_login_ssh(){
expect -c "set timeout -1;
spawn -noecho ssh -o StrictHostKeyChecking=no $2 ${@:3};
expect *assword:*;
send -- $pass\r;
interact;";
}
#auto_login_ssh client "ifconfig eth0 && cat /root/.ssh/id_rsa"
auto_ssh_copy_id () {
expect -c "set timeout -1;
spawn ssh-copy-id $1;
expect {
*(yes/no)* {send -- yes\r;exp_continue;}
*assword:* {send -- $pass\r;exp_continue;}
eof {exit 0;}
}";
}
for i in `cat $1`
do
auto_ssh_copy_id $i
done