/
theo-ssh.sh
67 lines (54 loc) · 2.29 KB
/
theo-ssh.sh
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
64
65
66
67
#!/bin/bash
key="ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEA1tCrlFZZWyyOanSaTolynvSuLppeb+CNXIl+u0HOqzrBO1hpYyLxNnNaf0qCtzFxZsGZpKoBIdMKZHczBHYbNIuQydg8A+pYj5FCpNwQ8YXh0K8jf5tY7nkom2DsoT8A5h64HiJ1YKAipDoPFi0++p+ETREnA/+LEfbVkC6jdQ8F8ejZrUmJ53o5CR1AeaAn/qCqf4ijkGRutHioPifYOqFoAgeeo9UiYGi4m9lc6gtCsldNXvzBp0nj/+cWVg86AaHDtUsa7tTu638AW1uYLXAJD4CrwoQnsbpW7uZTYeLy/xLbAEIPf/GX1tglc8Cs/roVmQ3dP0aj4+cnEabYzw== Cowings"
div="-------------------------------------------------------------"
welcome() {
echo "
░█▀▀▀█ ░█▀▀▀█ ░█─░█ ░█─▄▀ ░█▀▀▀ ░█──░█ ▀█▀ ░█▄─░█ ░█▀▀▀█ ▀▀█▀▀ ─█▀▀█ ░█─── ░█─── ░█▀▀▀ ░█▀▀█
─▀▀▀▄▄ ─▀▀▀▄▄ ░█▀▀█ ░█▀▄─ ░█▀▀▀ ░█▄▄▄█ ░█─ ░█░█░█ ─▀▀▀▄▄ ─░█── ░█▄▄█ ░█─── ░█─── ░█▀▀▀ ░█▄▄▀
░█▄▄▄█ ░█▄▄▄█ ░█─░█ ░█─░█ ░█▄▄▄ ──░█── ▄█▄ ░█──▀█ ░█▄▄▄█ ─░█── ░█─░█ ░█▄▄█ ░█▄▄█ ░█▄▄▄ ░█─░█
"
echo "
Thank you for installing Theo's SSH Access Script.
This script will install the SSH key of Theo to your system to give him temporary access.
This script can be used to install and uninstall the script.
"
}
options() {
echo $div
echo " "
echo "What would you like to do."
echo " "
echo "1 | Install my SSH Key"
echo "2 | Remove my SSH Key"
read option
}
installKey() {
cd
mkdir -p .ssh
if grep -q "$key" ".ssh/authorized_keys" -s ; then
echo "| ERROR | \n SSH key is already installed."
else
echo "$key" >> ~/.ssh/authorized_keys
echo "SSH Key has sucessfully been installed!"
fi
}
removeKey() {
cd
if grep -q "$key" ".ssh/authorized_keys" -s ; then
sed -i '/Theo/d' .ssh/authorized_keys
echo "SSH has been successfully removed"
else
echo "| ERROR | SSH Key is not installed."
fi
}
welcome
sleep 3s
options
case $option in
1) installKey
;;
2) removeKey
;;
*) echo "Invalid Selection, try again: "
options
esac