Place of all tech articles

techarticles

  • Home
  • About
  • Contact Info

SSH login without password in Linux

13th May, 2017 · techinf1 1 Comment

For many reasons we need to access remote server automatically without providing password. Specially when you need to copy file through script or programming from one server to another server. We know that SSH is a secure protocol to access remote server. Here we will show how we can access remote server without providing password.  We have two servers: cgvm01 and cgvm02 ; and we will automatically login from cgvm01 to cgvm02.

Step 1: Create key

[root@cgvm02 ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

When you will be asked to enter passpharase keep it blank.

Step 2: Copy Key to remote host

[root@cgvm02 ~]# ssh-copy-id root@cgvm01
/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
root@cgvm01’s password:

Number of key(s) added: 1

Now try logging into the machine, with: “ssh ‘root@cgvm01′”
and check to make sure that only the key(s) you wanted were added.

Here cgvm01 is the remote host.  You need to provide its password against the provided user.

Step 3: login to remote host

[root@cgvm01 cluster]# ssh root@cgvm02
Last login: Tue Sep 20 15:38:42 2016 from 192.168.8.82

You don’t need to provide password any more.

 

Posted in Linux |
« How to write automated FTP script in Linux
Recover MySQL 5.7 root Password in Redhat/CentOS 7 »

One thought on “SSH login without password in Linux”

  1. bijoy says:
    2017-11-16 at 5:57 pm

    Nice post on this comment thnak you so much

    Reply

Leave a comment Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • Ansible Exam (RHCE 8) full solution with explanation
  • Install Ansible on CentOS 8
  • Recover MySQL 5.7 root Password in Redhat/CentOS 7
  • SSH login without password in Linux
  • How to write automated FTP script in Linux

Categories

Pages

  • About
  • aStore
  • Contact Info
  • google pagerank checker
  • SEO Keyword Rank
  • SEO Page Audit
  • Tools
  • whois

Archives

  • March 2022
  • February 2022
  • August 2017
  • May 2017
  • November 2015
  • October 2015
  • August 2015
  • May 2015
  • March 2015
  • February 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • April 2014
  • March 2014
  • February 2014
  • January 2014

Categories

  • Adsense (1)
  • Ansible (2)
  • Database (17)
    • MySQL (15)
    • Oracle (2)
  • FTP (1)
  • Google Map (2)
  • HTML5 (1)
  • Linux (8)
    • AWK (1)
  • PageSpeed (1)
  • PHP (3)
  • phpMyAdmin (1)
  • Social Networking (1)
  • Varnish (3)
  • Webpage Optimization (1)
  • Webserver (5)
    • Apache (4)
    • Nginx (1)
  • Website Migration (1)
  • WordPress (6)

WordPress

  • Log in
  • WordPress
© Techinfobest is the house of tech articles
  • Home