what are the steps for Password-less ssh

Answer Posted / jani

Step 1: Create Authentication SSH-Kegen Keys on – (192.168.1.1)
First login into server 192.168.1.1 with user tecmint and generate a pair of public keys using following command.
[tecmint@tecmint.com ~]$ ssh-keygen -t rsa

Generating public/private rsa key pair.
Enter file in which to save the key (/home/tecmint/.ssh/id_rsa): [Press enter key]
Created directory '/home/tecmint/.ssh'.
Enter passphrase (empty for no passphrase): [Press enter key]
Enter same passphrase again: [Press enter key]
Your identification has been saved in /home/tecmint/.ssh/id_rsa.
Your public key has been saved in /home/tecmint/.ssh/id_rsa.pub.
The key fingerprint is:
af:bc:25:72:d4:04:65:d9:5d:11:f0:eb:1d:89:50:4c tecmint@tecmint.com
The key's randomart image is:
+--[ RSA 2048]----+
| ..oooE.++|
| o. o.o |
| .. . |
| o . . o|
| S . . + |
| . . . o|
| . o o ..|
| + + |
| +. |
+-----------------+
Step 2: Create .ssh Directory on – 192.168.1.2
Use SSH from server 192.168.1.1 to connect server 192.168.1.2 using sheena as user and create .ssh directory under it, using following command.
[tecmint@tecmint ~]$ ssh sheena@192.168.1.2 mkdir -p .ssh

The authenticity of host '192.168.1.2 (192.168.1.2)' can't be established.
RSA key fingerprint is d6:53:94:43:b3:cf:d7:e2:b0:0d:50:7b:17:32:29:2a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.2' (RSA) to the list of known hosts.
sheena@192.168.1.2's password: [Enter Your Password Here]
Step 3: Upload Generated Public Keys to – 192.168.1.2
Use SSH from server 192.168.1.1 and upload new generated public key (id_rsa.pub) on server 192.168.1.2 under sheena‘s .ssh directory as a file name authorized_keys.
[tecmint@tecmint ~]$ cat .ssh/id_rsa.pub | ssh sheena@192.168.1.2 'cat >> .ssh/authorized_keys'

sheena@192.168.1.2's password: [Enter Your Password Here]
Step 4: Set Permissions on – 192.168.1.2
Due to different SSH versions on servers, we need to set permissions on .ssh directory and authorized_keys file.
[tecmint@tecmint ~]$ ssh sheena@192.168.1.2 "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"

sheena@192.168.1.2's password: [Enter Your Password Here]
Step 5: Login from 192.168.1.1 to 192.168.1.2 Server without Password
From now onwards you can log into 192.168.1.2 as sheena user from server 192.168.1.1 as tecmint user without password.
[tecmint@tecmint ~]$ ssh sheena@192.168.1.2

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between ext3 and ext4?

2011


This question is belong to linux support. "one of my customer told to me, my application is getting slow response". how to resolve the issue. what are the steps you will follow to resolve the issue.

1460


1. User gaves df -h and the system get hanged. why ? 2. what is the hardlink and softlink mount ? 3. why is portmape should be started ? 4. what is nologin option 5. how to restrict users from accessing nfs ? 6. what is the difference between cpio and tar 7. what are the kernel parameters ? how to find out it ? 8. why we use sysctl.conf ? 9. if we gives init1 from multiuser runlevel, will it affect other users who already logged in to the system ? 10. what will be the available space to use after configuering raid5 with 5 disks each having 5gb spce ?

2290


Why is it suggested to disable journalism in ext4 filesystem?

3057


i installed clustering packages.When i try to run it getting LUCI error...what is it..??

1948






What are the differences between FTP , NFS , SAMBA servers explain separately.

702


what is the gate of ftp server in redhat linux?

1440


How to Trouble shoot performance issue in RHEL administration ? please give to one example

1630


what is difference between  TFTP abd FTP?

1613


What is Hard mount and soft Mount?

1361


How to catagories tickets in RHEL, which tickets are belong to PROBLEM, INCIDENT and CHANGE management? please given to me with examples

1332


As a system admin i want to know some things what are the troubleshooting issues we are facing frequently and what are the tickets will be raised.

1081


I want to configure production interface and manage interface, how to configure both interfaces in Linux. please post the answers

1498


why /etc/shadow file do not have any permission ?

1046