summaryrefslogtreecommitdiffstats
path: root/geo-replication/src/peer_add_secret_pub.in
blob: aed93991e58cf8002c27ac32c60346acb5555409 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

if [ "$1" == "" ]; then
    home_dir=`getent passwd root | cut -d ':' -f 6`;
else
    home_dir=`getent passwd $1 | cut -d ':' -f 6`;
fi

if [ "$home_dir" == "" ]; then
    echo "Invalid User";
    exit 1;
fi

if [ ! -d $home_dir/.ssh ]; then
    mkdir $home_dir/.ssh;
    chmod 700 $home_dir/.ssh;
    chown root:root $home_dir/.ssh;
fi

cat "$GLUSTERD_WORKING_DIR"/geo-replication/common_secret.pem.pub >> $home_dir/.ssh/authorized_keys;