Implementation of ssh non-secret communication in linux

Implementation of ssh non-secret communication in linux

What is ssh

Administrators can log in remotely to manage multiple hosts located in different locations that are connected via the Internet.

Administrators can perform the following operations on remote hosts:

  • Remote login
  • Remote Command Execution
  • Remote file transfer

Unfortunately, these operations are not safe!

Use plain text passwords and send them in clear text

  • Information may be intercepted and passwords may be retrieved
  • Unauthorized personnel use intercepted passwords to log into the system and cause damage to the system

During daily operation practice, when logging in to other hosts with ssh, you may need to enter the login password every time, even when using scp to copy something.

In order to switch hosts more conveniently and quickly, ssh non-encrypted communication is a better choice;

Generate a key using ssh-keygen, which is saved locally by default in /root/.ssh/id_rsa

Then use ssh-copy-id to distribute to the target host; log in as user@host name or IP address

Notice:

1. It is best to use the host name and write the host name and the corresponding IP address in the /etc/hosts file;

2. Password-free communication requires mutual authentication between both parties, so the same operation needs to be performed on the target host.

[root@www ~]# ssh-keygen -t rsa -P '' 
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
/root/.ssh/id_rsa already exists.
Overwrite (y/n)?
[root@www ~]#ssh-copy-id -i .ssh/id_rsa.pub [email protected]
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: ".ssh/id_rsa.pub"
The authenticity of host '172.16.75.1 (172.16.75.1)' can't be established.
ECDSA key fingerprint is SHA256:YXhbTS9MfK2IQC4gtOW4RL8voHvFqC1cAAMJXuF3Wec.
ECDSA key fingerprint is MD5:2c:c0:94:e8:3a:e4:74:88:c0:d8:e0:01:20:81:1d:8e.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]'s password: 
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '[email protected]'"
and check to make sure that only the key(s) you wanted were added.

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:
  • Detailed explanation of how to pass password to ssh/scp command in bash script
  • Detailed explanation of how to mount remote file systems via SSH on Linux
  • CentOS method to modify the default ssh port number example
  • Detailed installation and use of SSH in Ubuntu environment
  • Instructions for deploying projects to remote machines using the Publish Over SSH plugin in Jenkins
  • CentOS 6.5 configuration ssh key-free login to execute pssh command explanation
  • Ubuntu basic settings: installation and use of openssh-server
  • How to install MySQL via SSH on a CentOS VPS
  • How to configure ssh/sftp and set permissions under Linux operating system
  • Explanation of Mac connecting to remote servers through SSH in different terminals

<<:  How to achieve 3D dynamic text effect with three.js

>>:  Detailed explanation of how to restore database data through MySQL binary log

Recommend

How to expand the disk size of a virtual machine

After Vmvare sets the disk size of the virtual ma...

Learn MySQL database in one hour (Zhang Guo)

Table of contents 1. Database Overview 1.1 Develo...

Implementation of Docker deployment of ElasticSearch and ElasticSearch-Head

This article mainly explains how to deploy Elasti...

Getting Started with Vue 3.0 Custom Directives

Table of contents 1. Custom instructions 1. Regis...

Modify the style of HTML body in JS

Table of contents 1. Original Definition 2. JS op...

How to transfer files between Docker container and local machine

To transfer files between the host and the contai...

Detailed explanation of CSS3 to achieve responsive accordion effect

I recently watched a video of a foreign guy using...

HTML table tag tutorial (13): internal border style attributes RULES

RULES can be used to control the style of the int...

Implementation of master-slave replication in docker compose deployment

Table of contents Configuration parsing Service C...

Rainbow button style made with CSS3

Result: Implementation code: html <div class=&...