zoukankan      html  css  js  c++  java
  • 登陆ssh不需要使用密码

    假设A,B两服务器,现在需要在A机上用root登陆B机,而不需要输入密码,那我们可按照下面的步骤来做:
    1)在A机上生成钥匙对

    A# ssh-keygen -t rsa  
    Generating public/private rsa key pair.
    Enter file in which to save the key (/root/.ssh/id_rsa):
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /root/.ssh/id_rsa.
    Your public key has been saved in /root/.ssh/id_rsa.pub.
    The key fingerprint is:
    f6:61:a8:27:35:cf:4c:6d:13:22:70:cf:4c:c8:a0:23 mlsx@mlsx

    2)把在A机生成的id_rsa.pub拷贝到B机上

    scp -P 3721 /root/.ssh/id_rsa.pub  
    xx.xx.xx.xx
    :/tmp

    3)用root帐号登陆B机,进入其主目录,创建authorized_keys文件,并设置好权限

    B# cd ~/.ssh
    #cat /tmp/id_rsa.pub >>authorized_keys
    #chmod  400 authorized_keys

    4)测试

    ssh -p 3721 xx.xx.xx.xx
  • 相关阅读:
    ServletConfig对象
    乱码问题
    response request
    mysql
    数据库三范式 简单理解
    会话 cookie
    ServletContext对象
    读取工程中的配置文件
    Servlet与缓存
    C#捕获异常崩溃时
  • 原文地址:https://www.cnblogs.com/tjxwg/p/2974820.html
Copyright © 2011-2022 走看看