blob: 247d33146d4e9b5716d5e02339c70e760c09b4a7 [file] [log] [blame]
tom2d7acb72014-09-22 22:13:00 -07001#!/bin/bash
2#-------------------------------------------------------------------------------
tom1a2908c2014-09-23 16:37:39 -07003# Pushes the local id_rsa.pub to the authorized_keys on a remote ONOS node.
tom2d7acb72014-09-22 22:13:00 -07004#-------------------------------------------------------------------------------
5
6[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7. $ONOS_ROOT/tools/build/envDefaults
8
9remote=$ONOS_USER@${1:-$OCI}
10
11scp -q ~/.ssh/id_rsa.pub $remote:/tmp
tom22288032014-10-07 08:16:53 -070012ssh $remote "
13 cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys
14 sort -u ~/.ssh/authorized_keys > ~/.ssh/authorized_keys.bak
15 mv ~/.ssh/authorized_keys.bak ~/.ssh/authorized_keys
16"
tom2d7acb72014-09-22 22:13:00 -070017ssh -n -o PasswordAuthentication=no $remote true