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

Apache ab concurrent load stress test implementation method

ab command principle Apache's ab command simu...

Detailed analysis of MySQL master-slave delay phenomenon and principle

1. Phenomenon In the early morning, an index was ...

MySql grouping and randomly getting one piece of data from each group

Idea: Just sort randomly first and then group. 1....

XHTML Getting Started Tutorial: XHTML Tags

Introduction to XHTML tags <br />Perhaps you...

How to run commands on a remote Linux system via SSH

Sometimes we may need to run some commands on a r...

Example code of how to create a collapsed header effect using only CSS

Collapsed headers are a great solution for displa...

In-depth understanding of MySQL slow query log

Table of contents What is the slow query log? How...

How to implement call, apply and bind in native js

1. Implement call step: Set the function as a pro...

Detailed tutorial on installing nacos in docker and configuring the database

Environment Preparation Docker environment MySQL ...

Two examples of using icons in Vue3

Table of contents 1. Use SVG 2. Use fontAwesome 3...

Solution for applying CSS3 transforms to background images

CSS transformations, while cool, have not yet bee...

Alibaba Cloud Server Ubuntu Configuration Tutorial

Since Alibaba Cloud's import of custom Ubuntu...

The process of SSH service based on key authentication in Linux system

As we all know, SSH is currently the most reliabl...

Install Tomcat on Linux system and configure Service startup and shutdown

Configure service startup and shutdown in Linux s...