Wednesday, July 09, 2014

Solaris remote public key authorization

Still a pain in Solaris 11. Openssh ssh-copy-id still does not work as expected so the process is manual unless you want to risk having multiple keys authorized for the same host remotely.
#1 Generate local key
ssh-keygen -t rsa -N '' -f /export/home/geneva/.ssh/id_rsa
#2 Authorize it remotely:
cat /export/home/geneva/.ssh/id_rsa.pub | ssh $remoteHost 'cat >> .ssh/authorized_keys && echo "Key copied"'
#3 Go to the remote server to eliminate duplicates:
gawk '!x[$0]++' ~/.ssh/authorized_keys > ~/.ssh/authorized_keys2
mv ~/.ssh/authorized_keys2 ~/.ssh/authorized_keys

No comments:

Followers