Linux remote login implementation tutorial analysis

Linux remote login implementation tutorial analysis

Linux is generally used as a server, and the server is generally placed in a computer room. You cannot operate your Linux server in a computer room.

At this time we need to remotely log in to the Linux server to manage and maintain the system.

In Linux system, remote login function is realized through ssh service. The default ssh service port number is 22.

Linux remote login clients on Window systems include SecureCRT, Putty, SSH Secure Shell, etc. This article uses Putty as an example to log in to the remote server.

Putty download address: http://www.putty.org/

If you downloaded putty, double-click putty.exe and the following window will pop up.

In the box below Host Name (or IP address), enter the remote server IP you want to log in to (you can view the server IP through the ifconfig command), and then press Enter.

At this point, we are prompted to enter the username to log in.

Enter root and press Enter, then enter the password to log in to the remote Linux system.

Remote login to Linux using key authentication mechanism

SSH is the abbreviation of Secure Shell, which was developed by the Network Working Group of IETF.

SSH is a security protocol based on the application layer and transport layer.

First use the tool PUTTYGEN.EXE to generate a key pair. After opening the tool PUTTYGEN.EXE, the following figure is shown:

This tool can generate keys in three formats: SSH-1 (RSA) SSH-2 (RSA) SSH-2 (DSA). We use the default format, SSH-2 (RSA). Number of bits in a generated key refers to the size of the generated key. The larger the value, the more complex the generated key is and the higher the security is. Here we write 2048.

Then click Generate to start generating the key pair:

Please note that the mouse must move back and forth during this process, otherwise the progress bar will not move.

At this point, the key pair has been generated. You can enter a passphrase for your key (in the Key Passphrase field) or leave it blank. Then click Save public key to save the public key and click Save private key to save the private key. The author suggests that you put it in a safer place, firstly to prevent others from snooping, and secondly to prevent accidental deletion. Next, it's time to set up on the remote Linux host.

1) Create the directory /root/.ssh and set permissions

[root@localhost ~]# mkdir /root/.ssh The mkdir command is used to create a directory. It will be introduced in detail later. For now, just understand it.

[root@localhost ~]# chmod 700 /root/.ssh The chmod command is used to modify file attribute permissions, which will be introduced in detail later.

2) Create the file /root/.ssh/authorized_keys

[root@localhost ~]# vim /root/.ssh/authorized_keys The vim command is a command for editing a text file, which will also be introduced in detail in subsequent chapters.

3) Open the public key file you just generated. It is recommended to use WordPad to open it so that it is more comfortable to read. Copy all the contents from the beginning of AAAA to the line "---- END SSH2 PUBLIC KEY ----" and paste it into the /root/.ssh/authorized_keys file. Make sure all the characters are on one line. (You can copy the copied content to Notepad first, then edit it into a line and paste it into the file).

Here I would like to briefly introduce how to paste. After opening the file with vim, the file does not exist, so vim will automatically create it. Press the letter "i" and then press shift + Insert at the same time to paste (or right-click the mouse) if it has been copied to the clipboard. After pasting, move the cursor to the front of the line, enter ssh-rsa, and then press the space bar. Press ESC again, then enter a colon wq, that is, :wq, to ​​save. The format is as follows:

4) Set the putty options again, click SSh -> Auth on the left side of the window, click Browse... on the right side of the window, select the private key you just generated, and then click Open. At this time, enter root, and you can log in without entering a password.

If you have set a Key Passphrase before, you will be prompted to enter the password at this time. For greater security, it is recommended that you set a Key Passphrase.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to disable root remote login and add new users in Linux
  • Configuring remote password-free login under Linux
  • Teach you how to modify the Linux remote login welcome prompt information
  • Novice learn Linux commands: ssh command (remote login)
  • Linux platform mysql enable remote login
  • Use expect script to realize automatic login of remote machine in Linux
  • Remote login to Windows XP desktop under Linux rdesktop operating system

<<:  Native JS to implement paging click control

>>:  Detailed explanation of sql_mode mode example in MySQL

Recommend

MySQL character set viewing and modification tutorial

1. Check the character set 1. Check the MYSQL dat...

HTML table mouse drag sorting function

Effect picture: 1. Import files <script src=&q...

MySQL 4G memory server configuration optimization

As the number of visits to the company's webs...

JavaScript implements displaying a drop-down box when the mouse passes over it

This article shares the specific code of JavaScri...

Vue implements countdown function

This article example shares the specific code of ...

Sample code using scss in uni-app

Pitfalls encountered I spent the whole afternoon ...

Detailed example of concatenating multiple fields in mysql

The MySQL query result row field splicing can be ...

A brief discussion on whether CSS will block page rendering

Maybe everyone knows that js execution will block...

Detailed explanation of the installation steps of the MySQL decompressed version

1. Go to the official website: D:\mysql-5.7.21-wi...

Research on Web Page Size

<br />According to statistics, the average s...

Implementing a simple timer based on Vue method

Vue's simple timer is for your reference. The...

How to shut down/restart/start nginx

closure service nginx stop systemctl stop nginx s...

How to use an image button as a reset form button

When we make a form, we often set a submit button ...

Detailed explanation of CocosCreator optimization DrawCall

Table of contents Preface What is DrawCall How do...

How to process local images dynamically loaded in Vue

Find the problem Today I encountered a problem of...