In Linux, you do not need to enter a password to automatically log on to the ssh server.
When you log on to the ssh server using OpenSSH in linux, you are prompted to enter the password each time. When you use the vim netrw plug-in to edit a remote file, you need to enter the password each time you modify the file and save it. This is very troublesome. I checked the help document of netrw and found that I have introduced how to automatically log on to the ssh server:
1. Create a public/private key pair (on the client machine)
ssh-keygen -t rsa(saving the file in ~/.ssh/id_rsa as prompted)
After you enter the preceding command (do not enter it in parentheses), you will be prompted to enter passphrase and press ENTER twice without passphrase.
In this case, you can see ~ /. Two files generated under the ssh Directory: id_rsa and id_rsa.pub.
Tip: If the id_rsa key file already exists in the. ssh directory, you can change it to another name, but you still need to put it in the. ssh directory.
2. Create a. ssh directory on the ssh server
Log on to the ssh server and enter the following command.
cdmkdir -p .sshchmod 0700 .ssh
3. Create an authenticated keys on the server
Enter the following command on the client machine (not on the server)
ssh serverhostname cat '>>' '~/.ssh/authorized_keys' < ~/.ssh/id_rsa.pub
Enter the logon password.
4. OK. As a result, try logging on to the server using ssh serverhostname. You do not need to enter the password.
Why does LINUX fail to enter the password after logging on to the server remotely using ssh?
++ +
Supplement: Since the system cannot be connected, the problem is either on the server or on the network.
Are you sure the route is normal ??
++ ++
Is the logon successful?
1. Check whether the machine can be pinged first.
2. If you can ping the server, check whether the local firewall is enabled, because it takes a long time to mount the server,
3. If it is not the problem above, you can use SSH to debug the command.
Ssh-v Server IP Address
In this way, you can check the latency and analyze the latency.
This can solve the problem of Logon for a long time in 2. The general method is as follows:
(1) modify the/etc/hosts file of the client and write the ip address and the corresponding file name of the server to the file.
Format: Server Host Name Server IP Address
(2) modify the/etc/ssh/ssh_conf and GSSAPIAuthentication yes ---> GSSAPIAuthentication no of the client. If it is SSH2, you can disable user authentication for this GSSAPI. When a GSSAPI user authenticates to log on, the client needs to reverse resolve the IP address of the server. If the IP address of the server is not configured with the PTR record, it is easy to get stuck here.
I wish you good luck when you look at the specific analysis you have debugged.
In linux, how can I automatically enter yes when logging on via ssh without a password?
Remember to replace the carriage return with the linux format,
Or you can use vi to edit it.
#! /Bin/bash
Ssh root@192.168.1.111
Yes
Test