I am trying to copy .ssh/id_rsa.pub from our central server to multiple servers. I have the following script which I usually use to push changes to the different servers.
#!/bin/bash for ip in $(<IPs); do # Tell the remote server to start bash, but since its # standard input is not a TTY it will start bash in # noninteractive mode. ssh -q "$ip" bash <<-'EOF' EOF done
But in this case, I need to cat the public key on the local server and then add that to multiple servers. Is there a way by using the above here document script to execute the following.
cat .ssh/id_rsa.pub |ssh email@example.com 'cat > .ssh/authorized_keys'