#!/bin/bash

mkdir -p /home/vcap/.ssh
cat /var/vcap/jobs/db-node/config/id_rsa.pub > /home/vcap/.ssh/authorized_keys
chown -R vcap:vcap /home/vcap/.ssh
chmod 750 /home/vcap/.ssh
chmod 600 /home/vcap/.ssh/authorized_keys

#!/bin/bash

mkdir -p /home/vcap/.ssh
cat /var/vcap/jobs/db-node/config/id_rsa.pub > /home/vcap/.ssh/authorized_keys
chown -R vcap:vcap /home/vcap/.ssh
chmod 750 /home/vcap/.ssh
chmod 600 /home/vcap/.ssh/authorized_keys
lines=$(sudo wc -l /etc/sudoers)
insert_at=$(expr $lines - 1)
sudo sed -i "${insert_at}ivcap ALL=(ALL) NOPASSWD: ALL" /etc/sudoers

Allow password-less sudo to vcap user on db-nodes
Allow password-less sudo to vcap user on db-nodes
