Setup SSH Passwordless Login in Linux for oracle user
Source server : 10.1.1.1
Target server : 10.1.1.2
Genrate SSH key pair
[oracle@10.1.1.1]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:CQIzV4K1UyZ/7WmRtLTyPb1N3EHRXoZj4W09bbcQtDk oracle@ip-10.1.1.1.ec2.internal
The key's randomart image is:
+---[RSA 3072]----+
| +o=.+ o .o.=o|
| .= B + + .O.*|
| + o o * E.*O|
| o o = + .o+B|
| S = o ..+|
| . . + |
| . .|
| |
| |
+----[SHA256]-----+
[oracle@10.1.1.1]$
[oracle@10.1.1.1]$
[oracle@10.1.1.1]$
Upload SSH Key to target server – 10.1.1.2
ssh-copy-id oracle@10.1.1.2
[oracle@10.1.1.1]$
[oracle@10.1.1.1]$ ssh-copy-id oracle@10.1.1.2
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/oracle/.ssh/id_rsa.pub"
The authenticity of host '172.31.21.233 (172.31.21.233)' can't be established.
ECDSA key fingerprint is SHA256:0cU9N1c6iec4IMkhQeT8s7FmzF04X0iLy8pytlr1JCk.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/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
oracle@172.31.21.233's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'oracle@10.1.1.2"
and check to make sure that only the key(s) you wanted were added.
[oracle@10.1.1.1]$
[oracle@10.1.1.1]$
Test and validate passwordless login
Option:1
[oracle@10.1.1.1]$
[oracle@10.1.1.1]$
[oracle@10.1.1.1]$ ssh oracle@10.1.1.2
Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Tue May 23 16:57:35 2023
[oracle@10.1.1.2 ~]$
[oracle@10.1.1.2 ~]$
Option:2
[oracle@10.1.1.1]$ ssh -l oracle 10.1.1.2
Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Tue May 23 17:06:21 2023 from 10.1.1.1
[oracle@10.1.1.2]$
No comments:
Post a Comment