Ssh, scp does not enter a password to operate

  

Often scp copy files between different linux machines, always have to enter a password to be feasible.

Generate a public key through ssh-keygen and establish a trust channel between the two machines.

Suppose the local machine client, the remote machine is the server.

1. Generate rsa keygen

[winter@client winter] $ ssh-keygen -b 1024 -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/home/winter/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again: < Br>

Your identification has been saved in /home/winter/.ssh/id_rsa.

Your public key has been saved in /home/winter/.ssh/id_rsa.pub.

The key fingerprint is:

33:d4:7b:9c:87:04:cf:14:40:22:6d:c7:15:78:97:6a winter@client

Directly enter the address of the public key and private key directly, and the private key password can be directly returned or entered.

2. View multiple private and public key files in the .ssh directory

[winter@client winter] $ ls .ssh/

id_rsa id_rsa.pub known_hosts< Br>

3. Copy the public key to the target machine and rename it to authorized_keys

[winter@client winter] $ scp .ssh/id_rsa.pub [email protected]:/home/winter/.ssh/authorized_keys

The authenticity of host '192.168.0.110(192.168.0.110)' can't be established.

RSA key fingerprint is 5b:78:e8:e9:dc: D8:db:bd:f7:66:44:e6:3b:ce:f2:79.

Are you sure you want to continue connecting (yes/no)? yes

Warning : Permanently added '192.168.0.110' (RSA) to the list of known hosts.

[email protected]'s password:

id_rsa.pub 100% 221 1.2MB/s 00 :00

When you first use the scp command, you will be prompted to enter your password, and if you want to continue the link,

4. Test ssh into

[winter@client winter] $ ssh 192.168.0.110

5. Ok, get it!< Br>

[winter@server winter] # it's ok!

Copyright © Windows knowledge All Rights Reserved