Public Key Authentication

ssh public key authentication

Before setup mirroring database, its important to setup public key authentication. All nodes can connect to each other via this IP without password promt with user root.

OS : Centos 7
IP master : 192.168.11.9
IP slace : 192.168.11.10

1. the first we check the IP
# ip a
public key authentication


2. For root, we need to generate a new RSA-keypair foll all nodes
# ssh-keygen


3. Change user permission and then move to directory ~/.ssh
# mkdir -p ~/.ssh
#chmod 700 ~/.ssh
#cd ~/.ssh/
4. Make sure there id_rsa.pub from generate RSA-keypar in step 1.
# ls
#cat id_rsa.pub


5. To allow all node to connect to each other and accept each other’s key, we need to add the generate public keys of all host to /root/.ssh/authorized_keys. Follow this commend below
#nano /root/.ssh/authorized_keys

#chmod 600 ~/.ssh/authorized_keys

6. Then add all hosts to known_hosts file
#ssh-keyscan -H {192.168.11.9,192.168.11.10}|sudo tee /root/.ssh/known_hosts

7. After that, transfer authorized_keys to other node
# sudo scp /root/.ssh/{authorized_keys,known_hosts} 192.168.11.10:/root/.ssh

8. Check ssh other node. If you can ssh without password, your succes setup the public key authentication



Post a Comment

Previous Post Next Post