-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathppk2ssh
More file actions
40 lines (34 loc) · 794 Bytes
/
ppk2ssh
File metadata and controls
40 lines (34 loc) · 794 Bytes
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
#!/usr/bin/env bash
# Made by Sinfallas <[email protected]>
# Licence: GPL-2
LC_ALL=C
nom=$(basename "$0")
function ayuda() {
echo "Ejemplo: $nom /home/user/key.ppk /home/user/id_dsa"
exit 1
}
if [[ "$EUID" != "0" ]]; then
echo "ERROR: Debe ser root"
exit 1
fi
if [[ -z "$1" ]]; then
ayuda
fi
if [[ -z "$2" ]]; then
ayuda
fi
if [[ $(dpkg --get-selections | grep -w "putty-tools" | awk '{print $1}' | head -1) = putty-tools ]]; then
echo "Convertiendo llave privada"
puttygen $1 -O private-openssh -o $2
echo "Convirtiendo llave publica"
puttygen $1 -O public-openssh -o $2.pub
chmod 600 $2
chmod 666 $2.pub
else
echo "ERROR: El paquete putty-tools no esta instalado, se procede a instalar"
apt update -q
apt -y install putty-tools
apt clean
fi
echo "Finalizado."
exit 0