1. 在ssh-client一边使用ssh-keygen生成一对rsa key

  $ssh-keygen -t rsa

2. 在ssh-client一边使用ssh-add将刚生成的private key加入到ssh agent中(旧配置方式没有这步哟)

  $ssh-add ~/.ssh/id_rsa

3. 将上述的public key(id_rsa.pub)的内容附加到ssh-server端的。ssh/authorized_keys中

  $cat ~/.ssh/id_rsa.pub | ssh username@ssh-server "cat - 》 authorized_keys"

如果有权限问题,请手动帖.

 

luojackdeMBP:~ jackluo$ ssh-keygen -t rsa -f ~/.ssh/id_rsa.bt -C "net.webjoy@gmail.com"
luojackdeMBP:~ jackluo$ ssh-add ~/.ssh/id_rsa.bt

luojackdeMBP:~ jackluo$ cat ~/.ssh/id_rsa.bt.pub >> ~/.ssh/authorized_keys
luojackdeMBP:~ jackluo$ scp ~/.ssh/authorized_keys root@ip
luojackdeMBP:~ jackluo$ scp ~/.ssh/authorized_keys root@ip:~/.ssh/

luojackdeMBP:~ jackluo$ vim ~/.ssh/config
luojackdeMBP:~ jackluo$ chmod 600 ~/.ssh/config
luojackdeMBP:~ jackluo$ vim ~/.ssh/config
luojackdeMBP:~ jackluo$ chmod 600 ~/.ssh/config

~/.ssh/config:
----------------------------
Host bt 121.40.68.204
    IdentityFile ~/.ssh/id_rsa.bt
    User root
    

 

相关文章:

  • 2021-11-23
  • 2021-11-23
  • 2021-12-14
  • 2021-06-13
  • 2021-06-19
  • 2022-12-23
  • 2022-12-23
  • 2021-11-22
猜你喜欢
  • 2022-12-23
  • 2021-08-22
  • 2021-09-09
  • 2022-02-07
  • 2021-10-18
  • 2021-11-23
相关资源
相似解决方案