summaryrefslogtreecommitdiffstats
path: root/client/boot-tools/clientstructure/root/generateSshKeysClient.sh
blob: 9857ad40592c90e48b98d4d88e532e30e80c2c3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
echo "comprobando directorio .ssh del root"
if [ ! -d /root/.ssh ]
then
    echo "creando directorio .ssh 600"
	mkdir -p /root/.ssh
	chmod 700 /root/.ssh
fi


echo "comprobando el fichero authorized_keys .ssh del root"
if [ ! -f /root/.ssh/authorized_keys ]
then
	echo "creando el fichero authorized_keys"
	touch /root/.ssh/authorized_keys
	chmod 600 /root/.ssh/authorized_keys
fi

ssh-keygen -q -f /root/.ssh/id_rsa -N ""
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys

## TODO: exportamos la publica a los repos
cp /root/.ssh/id_rsa.pub /tmp/rsa.ogclient.pub