In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
1. Overview
Ssh is a network communication protocol used for encrypted login between computers. Generally, there are two ways to connect to the server with ssh: password authentication and key authentication.
Password authentication is to log in through the traditional way of entering a password, and key authentication is to register the generated public key with the server and log in with the private key, so that you do not have to enter the password each time. It is especially suitable for lazy people like the author who can't remember passwords.
two。 Password authentication
Login with password authentication can directly use the ssh command on the terminal:
Ssh username@xxx.xxx.xxx.xxx
Username is the user name, followed by ip.
3. Key authentication (1) generates public and private keys
This step uses the ssh-keygen command to generate id_rsa and id_rsa.pub files:
Ssh-keygen-t rsa-b 4096-C "eamil"
Where email is your email address.
Then enter all the time (of course, you can also modify the parameters, such as the file names of the generated public key and private key, etc.).
(2) copy the public key to the server cd ~ / .sshssh-copy-id-I id_rsa.pub username@xxx.xxx.xxx.xxx
Notice that the public key is copied (.pub ends, not the private key id_rsa).
(3) modify local private key permissions
If the above situation occurs, according to the prompt, modify the permission of the private key as follows:
Chmod 600 id_rsa
Those who use wsl on windows should note that wsl cannot directly modify the file permissions, it needs to modify the / etc/wsl.conf file (if not, create a new one).
Vim / etc/wsl.conf
Input
[automount] enabled = trueoptions = "metadata,umask=22,fmask=11" mountFsTab = false
Exit wsl and restart.
(4) connect ssh-I ~ / .ssh/id_rsa username@xxx.xxx.xxx.xxx
If the above configuration does not appear, it can be connected.
(5) if you still need a password
First log in to the server with password authentication and modify / etc/ssh/sshd_config. (note that there is a file called ssh_config under dMagnee ssh and press tab.....)
Vim / etc/ssh/sshd_config
Find the PasswordAuthentication line.
Modify it to no.
Then restart the service:
Service ssh restart
Or
/ etc/init.d/ssh restart
Connect after restarting the service:
Ssh-I / .ssh/id_rsa username@xxx.xxx.xxx.xxx
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.