Linux configuration SSH Public key authentication and Jenkins telnet for automatic publishing

Source: Internet
Author: User

Public-key authentication is the use of a pair of cryptographic strings, a public key, which can be seen by anyone, used for encryption, and another known as a key (private key) that only the owner can see for decryption.

When using Jenkins to automatically build and remotely log on to the server for publishing applications, SSH Public key authentication is required to resolve the logon server issue.

In fact, it is very simple, only need two instructions.

"ssh-copy-id-i ~/.ssh/id_rsa.pub <IP>

Suppose there are two servers, a is the Jenkins build server, B is the application server, and a builds the application, and then uploads the package to B for publishing.

Execute Ssh-keygen-t rsa-p "on a above, two single quotes behind-p to indicate that the password is empty

After that, two files Id_rsa (private key) are created in the ~/.ssh directory, id_rsa.pub (public key)

Next continue to execute Ssh-copy-id-i ~/.ssh/id_rsa.pub <ip> on a, indicating that the public key is sent to B and sent to the ~/.SSH directory of the B server

After the use of SSH b<ip> to try to be able to password-free login B server, if you are prompted to enter passwords, there are the following reasons

A. A non-root account may not support SSH public key authentication (see if the server is limited)

B. The public key file passed over the permission is insufficient, can give this file authorization under chmod 644 Authorized_keys

C. Use the root account to execute ssh-copy-id-i ~/.ssh/id_rsa.pub <IP> This command if you need to enter a password to configure the Sshd_config

Vi/etc/ssh/sshd_config

Restart the SSHD service when you are finished modifying

Service sshd Restart

Finally, if SSH IP password-free login succeeds, the SSH public key authentication succeeds.

Next, the SSH configuration for Jenkins is as follows

Linux configuration SSH Public key authentication and Jenkins telnet for automatic publishing

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.