Как настроить S SH без пароля на CentOS 8 и putty - PullRequest
0 голосов
/ 07 августа 2020

Я постоянно настраиваю среды s sh без пароля. И хотя существует множество инструкций, большинство из них довольно длинные. Это будет очень коротко и без особых пояснений. Подробности читайте в погрузочных документах. Я планирую добавить скриншоты, но это нужно подождать, пока мое запястье не заживет. Я позавчера сильно сломал.

1 Ответ

0 голосов
/ 07 августа 2020
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->
...