Linux user establishes secret key authentication to implement shell script management, distribution and deployment

Source: Internet
Author: User
Tags ssh ssh server

Environment:

SSH server:192.168.100.29 server.example.com

SSH client:192.168.100.30 client.example.com

Create secret key authentication through root user to implement Shell script management, distribution, deployment

First, the client side creates the secret key pair and distributes the public key to the SSH server that needs to be logged on

Note: The public key is equivalent to a lock, the private key is equivalent to a key, we here is equivalent to create a pair of keys and locks on the client, want to do ssh password-free login, the equivalent of our lock distribution to the server and lock, then the client can use the key to unlock.

I. Establishing secret key authentication

1. Create a secret key pair on the client: (SSH client)

# Su-root

# Ssh-keygen-t DSA

You can return all the way

----------------------

Generating Public/private DSA key pair.

Enter file in which to save the key (/ROOT/.SSH/ID_DSA):

Created directory '/root/.ssh '.

Enter passphrase (empty for no passphrase):

Enter same Passphrase again:

Your identification has been saved IN/ROOT/.SSH/ID_DSA.

Your public key has been saved in/root/.ssh/id_dsa.pub.

The key fingerprint is:

e9:5e:4a:7f:79:64:c5:ae:f2:06:a7:26:e4:41:5c:0e root@zabbix.example.com

The key ' s Randomart image is:

+--[DSA 1024]----+

| |

|    E. |

| . +   . |

|   . O. o|

| S. O |

|  . O. + .|

| Oo.. B. |

| o +o * + |

|  O. + =. |

+-----------------+

----------------------

2. View the generated secret key pair: (SSH client)

# Ls-lda. SSH

-----------------

DRWX------2 root 4096 June 6 23:03 SSH

-----------------

# CD. SSH

# Ls-la

------------------

Total dosage 16

DRWX------2 root 4096 June 6 23:03.

Dr-xr-x---. Root root 4096 June 6 23:03.

-RW-------1 root 668 June 6 23:03 ID_DSA

-rw-r--r--1 Root 613 June 6 23:03 id_dsa.pub

------------------

Secret key Generation Complete

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.