preface

The front end boss of the company left the company for some reasons. He left in a hurry. I had little contact with this aspect before, and I had only a half-knowledge of it. In these two days, WHILE learning, I began to build, while recording the whole process of building.

In this series of articles, from setting up Gitlab, to installing and registering Gitlab-Runner, to combining the two to deploy a simple project, you will learn how to automate the packaging and deployment of your projects on Gitlab.

There are four articles in the series, including:

  1. How to install Gitlab on Aliyun
  2. Install GITLAB – RUNNER
  3. LINUX login without password
  4. Deploy GITLAB’s projects using Gitlab-Runner

As I have been doing is the front end, I am not skilled for Linux, if there is a mistake, please point out.

Original address: Linux no-password login

This is the third installment in the series, and in this installment, we’re going to do a little bit of Linux no-secret login, which we’ll use in the next installment.

Preparations:

A Linux server

One computer (mine is Windows 10)

Step1 generate an SSH key on Windows

Generate the SSH key

ssh-keygen -t rsa -C "[email protected]" # Replace your email here
Copy the code

Going to the SSH directory

cd ~/.ssh
Copy the code

View all files

ls -a 
Id_rsa id_rsa.pub
Copy the code

View the public key content (note the public key file ending in.pub)

cat id_rsa.pub
Copy the code

Copy the public key contents

ssh-rsa XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX [email protected]
Copy the code

Step2 write the public key copied in the previous step to Linux

Log in to the Linux server and run the following command

 ssh-keygen -t rsa
Copy the code

And then hit enter all the way

Then go to.ssh

 cd ~/.ssh
Copy the code

Edit the authorized_keys file

 vi authorized_keys
Copy the code

After entering the edit, press I to enter the modification, and copy the public key on our computer into it.

After the modification is complete, press Esc, :, w, q, and press Enter to save the modification.

And then check it out

cat authorized_keys
ssh-rsa XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX [email protected]
Copy the code

The modification is successful

Log in the

ssh [email protected] # Fill in your server IP
Copy the code

If your server is Ali Cloud and reinstalled the system, you may encounter the following error

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:xi/sxkP1juN+73HCAhkSXRMCuN48zfMjDTUylonzAPo.
Please contact your system administrator.
Add correct host key in /c/Users/Wen Minghui/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /c/Users/Wen Minghui/.ssh/known_hosts:8
ECDSA host key for xx.xxx.xxx.xxx has changed and you have requested strict checking.
Host key verification failed.
Copy the code

Solution: Run a command to clear the IP address of the connected server

 ssh-keygen -R XX.XX.XX.XX 
Copy the code

Try to connect again

ssh [email protected]
Copy the code

You can see that the login succeeded

Last Login: Wed Apr 17 18:03:44 2019 from 14.154.30.158 Welcome to Alibaba Cloud Elastic Compute Service!Copy the code

For Linux, the no-password login to Linux is similar, and the next article will use Gitlab-Runner to automate deployment of projects on Gitlab in conjunction with no-password login.

reference

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! The solution of the