Last active
October 15, 2019 17:51
-
-
Save mamedshahmaliyev/72129dd2b78dd4f9c08d3689377d1fff to your computer and use it in GitHub Desktop.
create ssh key pair silently using ssh-keygen without prompt and ssh-copy-id to multiple hosts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# generate ssy key pair silently | |
yes y | ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa > /dev/null | |
# register public key in multiple hosts | |
for ip in "192.168.0.1" "192.168.0.2"; do sshpass -p 'toor' ssh-copy-id -oStrictHostKeyChecking=no "root@$ip" > /dev/null; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment