setup password less connectivity between two Linux server
-bash-4.2$
-bash-4.2$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/pgsql/.ssh/id_rsa):
Created directory '/var/lib/pgsql/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/lib/pgsql/.ssh/id_rsa.
Your public key has been saved in /var/lib/pgsql/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:XHvRME2FNaXO6wAHk1wjPpjdzHwAJX6RY7yrvSfm7/g postgres@ip-172-31-86-192.ec2.internal
The key's randomart image is:
+---[RSA 2048]----+
| ++O+.==|
| B X=Bo..|
| o @.Bo+ |
| . . *.= |
| S o o.o |
| +. . |
| o. . |
| . ++. |
| o+BE |
+----[SHA256]-----+
-bash-4.2$
-bash-4.2$
-bash-4.2$
-bash-4.2$
-bash-4.2$
-bash-4.2$ ssh-copy-id postgres@172.31.85.11
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/var/lib/pgsql/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
postgres@172.31.85.11's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'postgres@172.31.85.11'"
and check to make sure that only the key(s) you wanted were added.
-bash-4.2$
try to test the login :
-bash-4.2$ ssh 172.31.85.11
Last login: Tue Dec 27 10:41:27 2022
__| __|_ )
_| ( / Amazon Linux 2 AMI
___|\___|___|
https://aws.amazon.com/amazon-linux-2/
-bash-4.2$
-bash-4.2$
No comments:
Post a Comment