【问题标题】:How to setup passwordless SSH on CentOS 8 and putty如何在 CentOS 8 和 putty 上设置无密码 SSH
【发布时间】:2020-08-13 08:03:37
【问题描述】:

我一直在设置无密码 ssh 环境。而且,虽然有很多howTos,但大多数都相当长。这将非常简短,没有太多解释。阅读加载文档以了解详细信息。我计划添加屏幕截图,但这必须等到我的手腕愈合之后。前天我把它弄坏了。

【问题讨论】:

标签: ssh centos putty


【解决方案1】:
PuTTY doesn't natively support the private key format (.pem)
   You must convert your private key into a .ppk file 
   before you can connect to your instance using PuTTY

ssh-keygen generates 2 files.  
 - id_rsa: The private key 
 - id_rsa.pub: The public key

PuTTYgen will genrate the ppk for use with PuTTY.

On Linux (I’m using CentOS 8)
=================================

    mkdir -p ~/.ssh
    chmod 700 ~/.ssh
    cd ~/.ssh
    ssh-keygen -t rsa -b 4096 -N '' -f ~/.ssh/id_rsa -C "yourEmailAddr@yahoo.com"
    cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys 
    chmod 400 ~/.ssh/*
    cp ~/.ssh/* /VMShare/ssh/ #a common mount between my virtual machines and windows

on Windows
----------
    1. open PuTTYgen Click Load and open the private file (normally id_rsa)
    2. Click “Save Private Key” and choose a name.  I use id_rsa.ppk
    3. Open Putty
    3.1. Set Connection->Data->Auto-login username as appropriate
    3.2. set the Connection->SSH->Auth->”Private key file for authentication” to the ppk file.

To setup 1 way ssh between 2 Linux machines
-------------------------------------------
    copy the id_rsa file to ~/.ssh on the second machine 
    Next: chmod 400 ~/.ssh/id_rsa
    Now you can ssh from the second machine to the first

To setup 1 way ssh between 2 Linux machines
-------------------------------------------
    Copy the id_rsa and id_rsa.pub file to ~/.ssh on the second machine
    cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys 
    chmod 400 ~/.ssh/authorized_keys  ~/.ssh/id_rsa  ~/.ssh/id_rsa.pub

To Test the ssh use:
--------------------

    ssh -i id_rsa.pub user@host1

<https://help.dreamhost.com/hc/en-us/articles/215464758-How-do-I-set-up-passwordless-login-in-PuTTY->

【讨论】:

    猜你喜欢
    • 2011-06-03
    • 1970-01-01
    • 2011-10-31
    • 2020-12-31
    • 2017-12-14
    • 1970-01-01
    • 1970-01-01
    • 2023-01-19
    • 2012-05-01
    相关资源
    最近更新 更多