• 企业400电话
  • 微网小程序
  • AI电话机器人
  • 电商代运营
  • 全 部 栏 目

    企业400电话 网络优化推广 AI电话机器人 呼叫中心 网站建设 商标✡知产 微网小程序 电商运营 彩铃•短信 增值拓展业务
    linux中ssh免密通信的实现

    什么是ssh

    管理员可以通过远程登陆的方式,对通过网相连的分散于各处的多台主机进行管理操作。

    管理员可以对远程主机进行如下操作:

    遗憾的事情是:这些操作不安全!

    使用纯文本口令,并用明文发送

    在日常操作练习时,用ssh登录其他主机时,可能会每次都需要输入登录密码,哪怕用scp复制东西也需要。

    为了更方便快捷的切换主机,ssh免密通信不失为更好的选择;

    用ssh-keygen生成密钥,默认保存在本地的/root/.ssh/id_rsa

    然后在用ssh-copy-id分发至目标主机之上;登录用户@主机名或IP地址

    注意:

        1.最好是用主机名,在/etc/hosts文件中写入主机名和对应的IP地址;

        2.免密通信需要双方相互认证,所以也需要在目标主机对本机做一次相同的操作;

    [root@www ~]# ssh-keygen -t rsa -P '' 
    Generating public/private rsa key pair.
    Enter file in which to save the key (/root/.ssh/id_rsa): 
    /root/.ssh/id_rsa already exists.
    Overwrite (y/n)?
    [root@www ~]#ssh-copy-id -i .ssh/id_rsa.pub root@172.16.75.1
    /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: ".ssh/id_rsa.pub"
    The authenticity of host '172.16.75.1 (172.16.75.1)' can't be established.
    ECDSA key fingerprint is SHA256:YXhbTS9MfK2IQC4gtOW4RL8voHvFqC1cAAMJXuF3Wec.
    ECDSA key fingerprint is MD5:2c:c0:94:e8:3a:e4:74:88:c0:d8:e0:01:20:81:1d:8e.
    Are you sure you want to continue connecting (yes/no)? yes
    /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
    /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
    root@172.16.75.1's password: 
    Number of key(s) added: 1
    Now try logging into the machine, with:  "ssh 'root@172.16.75.1'"
    and check to make sure that only the key(s) you wanted were added.

    以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。

    上一篇:在 Linux 上锁定虚拟控制台会话的实现方法
    下一篇:Nginx反代Mogilefs分布式储存示例详解
  • 相关文章
  • 

    © 2016-2020 巨人网络通讯

    时间:9:00-21:00 (节假日不休)

    地址:江苏信息产业基地11号楼四层

    《增值电信业务经营许可证》 苏B2-20120278

    linux中ssh免密通信的实现 linux,中,ssh,免密,通信,的,