copie de la bonne clef sur les noeuds
This commit is contained in:
parent
a640384c5b
commit
f945e19efb
@ -13,17 +13,17 @@
|
||||
#
|
||||
function copy_ssh_id()
|
||||
{
|
||||
local ip=${1}
|
||||
local host=${1}
|
||||
|
||||
ssh ${ip} bash -s <<EOF
|
||||
echo $(cat ~oneadmin/.ssh/id_rsa.pub) > /tmp/one-master.key.pub
|
||||
if ! grep -qs /tmp/one-master.key.pub ~oneadmin/.ssh/authorized_keys
|
||||
CLEF=$(cat ~oneadmin/.ssh/id_rsa.pub)
|
||||
ssh ${host} bash -s <<EOF
|
||||
if ! grep -qs $CLEF ~oneadmin/.ssh/authorized_keys
|
||||
then
|
||||
cat /tmp/one-master.key.pub >> ~oneadmin/.ssh/authorized_keys
|
||||
echo $CLEF >> ~oneadmin/.ssh/authorized_keys
|
||||
chown oneadmin:oneadmin ~oneadmin/.ssh/authorized_keys
|
||||
fi
|
||||
rm -f /tmp/one-master.key.pub
|
||||
EOF
|
||||
su - oneadmin -c "ssh-keyscan $host"
|
||||
return ${?}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user