File tree 3 files changed +15
-4
lines changed
3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
+ function bail {
4
+ echo " ************** ${1} **************"
5
+ exit 1
6
+ }
7
+
3
8
if [[ ${# } != 4 && ${# } != 5 ]]; then
4
9
echo " Usage: setup-new-server.sh <root@host> <ssh-public-key-file> <iptable-config-file> <ordinary-username> [ordinary-user-password]"
5
10
echo " "
@@ -9,22 +14,23 @@ if [[ ${#} != 4 && ${#} != 5 ]]; then
9
14
exit 1
10
15
fi
11
16
12
-
13
17
root_at_host=$1
14
18
ssh_key_file=$2
15
19
iptable_cfg_file=$3
16
20
ordinary_user=$4
17
21
18
22
ordinary_user_password=" "
19
- ordinary_user_password_confirm=" "
23
+ ordinary_user_password_confirm=" other "
20
24
if [[ ${# } == 5 ]]; then
21
25
ordinary_user_password=$5
22
26
else
23
27
while [[ ${ordinary_user_password} != ${ordinary_user_password_confirm} ]]; do
24
28
echo -n " Password: "
25
29
read -s ordinary_user_password
30
+ echo " "
26
31
echo -n " Password (again): "
27
32
read -s ordinary_user_password_confirm
33
+ echo " "
28
34
if [[ ${ordinary_user_password} != ${ordinary_user_password_confirm} ]]; then
29
35
echo " Passwords don't match"
30
36
fi
@@ -40,4 +46,4 @@ if ! [ -f ${iptable_cfg_file} ]; then
40
46
fi
41
47
42
48
scp output/* ${ssh_key_file} ${root_at_host} :/root
43
- ssh -t ${root_at_host} " /root/setup-new- server.sh ${ssh_key_file} ${iptable_cfg_file} ${ordinary_user} ${ordinary_user_password} "
49
+ ssh -t ${root_at_host} " /root/setup-server.sh ${ssh_key_file} ${iptable_cfg_file} ' ${ordinary_user} ' ' ${ordinary_user_password} ' "
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
+ function bail {
4
+ echo " ************** ${1} **************"
5
+ exit 1
6
+ }
7
+
3
8
if [[ ${# } != 4 ]]; then
4
- echo " Usage: setup-server.sh <ssh-public-key-file> <iptable-config-file> <ordinary-username> <ordinar -user-password>"
9
+ echo " Usage: setup-server.sh <ssh-public-key-file> <iptable-config-file> <ordinary-username> <ordinary -user-password>"
5
10
echo " "
6
11
echo " for example: setup-server.sh id_rsa.pub iptables-application-server.cfg myuser password"
7
12
exit 1
You can’t perform that action at this time.
0 commit comments