In order to login to RHEL7 Linux server we first need to exchange public keys between server and client machine. To do that we can use ssh-copy-id command.
$ ssh-copy-id user@rhel-server
The authenticity of host 'rhel-server (rhel-server)' can't be established.
ECDSA key fingerprint is 21:4d:71:f6:ef:1f:c1:f7:a9:d9:81:4d:9d:34:4d:a9.
Are you sure you want to continue connecting (yes/no)? 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
user@rhel-server's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'user@rhel-server'"
and check to make sure that only the key(s) you wanted were added.

SUBSCRIBE TO NEWSLETTER
Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


The above command will propt you for a password based upon which your access to the remote server will be authenticated and password exchanged. If you get an error message saying:
/usr/bin/ssh-copy-id: ERROR: No identities found
you first need to generate your ssh keys using below command:
$ ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
2a:2b:8b:c3:10:2c:0e:8a:7e:bf:0d:2c:fa:31:dc:99 This email address is being protected from spambots. You need JavaScript enabled to view it.n
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|.                |
|+.               |
|*.      S        |
|+.. o o.         |
|+  =.E.          |
|.+o.+oo          |
|.o++oo..         |
+-----------------+
Once done attempt to the above ssh-copy-id command again.
FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in:



Comments and Discussions