Below command is used to copy the key to single server.
# cat id_rsa.pub | ssh username@servername 'cat >> /home/user/.ssh/authorized_keys'
Below command is used to copy the key to multiple server. We can use for loop.
# for i in `cat serverlist`; do echo $i; cat id_rsa.pub | ssh username@servername 'cat >> /home/user/.ssh/authorized_keys'; done
Hope it helps.
Sunday, March 18, 2018
How to Add SSH Public Key to Remote Server(s) in a Single Command.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment