当前位置:网站首页>SSH password free login

SSH password free login

2022-07-28 22:30:00 5xp_ two thousand and one

Recent synchronization django Configuration requires secret free synchronization nas Catalog The configuration is sorted as follows

SSH Three steps to solve the secret free login

1. The client generates public and private keys

Local clients generate public and private keys :( Return all the way by default )

ssh-keygen
  • 1

The above command will be in the user directory .ssh Create a public / private key folder

cd ~/.ssh
  • 1
ls
  • 1

Create two keys under :

  1. id_rsa ( Private key )
  2. id_rsa.pub ( Public key )

2. Upload public key to server

The server address used for the test here is :192.168.235.22
The user is :root

ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
  • 1

The above command is written to the server ssh The list goes down

cd ~/.ssh
  • 1
vim authorized_keys
  • 1

You can see that the client writes to the server id_rsa.pub ( Public key ) Content .

3. Test password free login

ssh [email protected]

Client pass ssh Connect to remote server , You can log in without password .

Add

[[email protected] .ssh]# ssh-copy-id -i ./id_rsa.pub "-p 58422 [email protected]"

Reference resources https://www.cnblogs.com/chuyiwang/p/10729591.html

Report errors

ssh-copy-id -i ./id_rsa.pub -p 41022 [email protected]
Bad port 'umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> ~/.ssh/authorized_keys && (test -x /sbin/restorecon && /sbin/restorecon ~/.ssh ~/.ssh/authorized_keys >/dev/null 2>&1 || true)'

Report a mistake again

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
d5:e0:49:db:cb:ce:09:99:38:b6:7f:20:9a:b6:a6:35.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:5
RSA host key for [101.200.120.97]:41022 has changed and you have requested strict checking.
Host key verification failed.

terms of settlement It's empty known_hosts file test ssh Password login is normal Use the default id_rsa  Write... Manually authorized    after ok

原网站

版权声明
本文为[5xp_ two thousand and one]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/209/202207282046102796.html