-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtinycore-install-ssh
More file actions
63 lines (49 loc) · 1.64 KB
/
tinycore-install-ssh
File metadata and controls
63 lines (49 loc) · 1.64 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
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
step() {
echo -e "\e[1;36m+++ $1\e[0m";
}
ok() {
echo -e "\e[32m[success] \e[0m\n";
}
err() {
{ set +x; } 2>/dev/null
echo -e "\n\e[1;31mERROR! Check last command output for details.\e[0m";
echo -e "\nInstallation aborted.\n";
exit 1
}
pause() {
echo -e "\e[1;30mPress [return] for next step...\e[0m"
read
}
echo
# --------------------------------------------------------------------
step "Installing Open SSH package"
tce-load -w -i openssh.tcz || err
ok
step "Backup original config files"
sudo cp /usr/local/etc/ssh/sshd_config /usr/local/etc/ssh/sshd_config.original || err
sudo cp /usr/local/etc/ssh/ssh_config /usr/local/etc/ssh/ssh_config.original || err
sudo mv /usr/local/etc/ssh/sshd_config /usr/local/etc/ssh/sshd_config2 || err
sudo mv /usr/local/etc/ssh/ssh_config /usr/local/etc/ssh/ssh_config2 || err
sudo cp /usr/local/etc/ssh/sshd_config.original /usr/local/etc/ssh/sshd_config || err
sudo cp /usr/local/etc/ssh/ssh_config.original /usr/local/etc/ssh/ssh_config || err
ok
step "Persist whole ssh folder to keep configuration and keys"
if [ "`grep -Fx "usr/local/etc/ssh" /opt/.filetool.lst`" == "" ]
then
echo "Persisting usr/local/etc/ssh"
sudo sh -c 'echo "usr/local/etc/ssh" >> /opt/.filetool.lst'
ok
else
echo "usr/local/etc/ssh already persisted"
fi
echo "ifconfig eth0 up # added by tinycore-scripts" >> /opt/bootlocal.sh
echo "/usr/local/etc/init.d/openssh start # added by tinycore-scripts" >> /opt/bootlocal.sh
sudo /usr/local/etc/init.d/openssh start
#------------------------------------------------------------------------------
step "Backup changes\\n"
set -x
filetool.sh -b
{ set +x; } 2>/dev/null
ok
echo