oxmraz-mldo24 commited on
Commit
a8cfc9f
·
unverified ·
1 Parent(s): c107bb9

Attempt to add automated setting up access

Browse files
Files changed (2) hide show
  1. setupaccess.exp +8 -0
  2. setupaccess.sh +27 -0
setupaccess.exp ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/expect -f
2
+ spawn ./setupaccess.sh
3
+ set timeout 2
4
+ expect "Enter passphrase for key 'group17':\r"
5
+ send "$PASSPHRASE_GROUP17\r"
6
+ expect "Enter passphrase for key 'group17':\r"
7
+ send "$PASSPHRASE_GROUP17\r"
8
+ expect eof
setupaccess.sh ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ touch group17.pub
4
+ echo "$GROUP17_PUBLICKKEY" > group17.pub
5
+ echo "setupaccess.sh: make group17.pub file"
6
+
7
+ touch group17
8
+ echo "$GROUP17_PRIVATEKEY" > group17
9
+ echo "setupaccess.sh: make group17 file"
10
+
11
+ chmod 600 group17
12
+ echo "setupaccess.sh: change permissions of group17 file"
13
+
14
+ ssh-keygen -R "[paffenroth-23.dyn.wpi.edu]:22017"
15
+ echo "setupaccess.sh: remove known host keys for the server to avoid the REMOTE HOST IDENTIFICATION HAS CHANGED error"
16
+
17
+ cat group17.pub > authorized_keys
18
+ echo "setupaccess.sh: make an authorized_keys file with group17.pub as an authorized key"
19
+
20
+ scp -o StrictHostKeyChecking=no -i group17 -P 22017 authorized_keys [email protected]:/home/student-admin/.ssh
21
+ echo "setupaccess.sh: copy authorized_keys file to server"
22
+
23
+ rm authorized_keys
24
+ echo "setupaccess.sh: remove authorized_keys file from host"
25
+
26
+ ssh -p 22017 -i group17 -o StrictHostKeyChecking=no [email protected]
27
+ echo "setupaccess.sh: try to ssh in"