• linux scp ssh命令不用输入密码


    把你的本地主机用户的ssh公匙文件复制到远程主机用户的~/.ssh/authorized_keys文件中
    假设本地主机linux100,远程主机linux200
    一,在linux100主机里的用户
    运行
    #ssh-keygen -t rsa
    结果如下

    QUOTE:
    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/.username/ssh/id_rsa):#回车
    Enter passphrase (empty for no passphrase):#回车
    Enter same passphrase again:#回车
    Your identification has been saved in /home/.username /.ssh/id_rsa.
    Your public key has been saved in /home/.username /.ssh/id_rsa.pub.
    The key fingerprint is:
    38:25:c1:4d:5d:d3:89:bb:46:67:bf:52:af:c3:17:0c username@localhost
    Generating RSA keys:
    Key generation complete.

    会在用户目录~/.ssh/产生两个文件,id_rsa,id_rsa.pub
    二,把linux100主机上的id_rsa.pub文件拷贝到linux200主机的root用户主目录下的.ssh目录下,并且改名为authorized_keys
    即:
    /root/.ssh/authorized_keys
    这样在linux100主机上使用scp命令复制文件到linux200上将不提示输入密码了,直接复制了。
    反之亦然!
     
     
    从实验的过程中发现:
    双方只能在root权限下使用
     
    如果配置完成之后,发现还是不好使,需要检查/etc/ssh目录下的sshd_config文件下的
    RSAAuthentication yes
    PubkeyAuthentication yes
    AuthorizedKeysFile      .ssh/authorized_keys
     
    3行是否打开,如果为注释掉的,则需要打开。
     
  • 相关阅读:
    [zjoi]青蛙的约会_扩展欧几里德
    [coci2012]覆盖字符串 AC自动机
    出题日志
    [zjoi2003]密码机
    矩阵乘法
    洛谷 P1064 金明的预算方案
    洛谷 P1656 炸铁路
    洛谷 P1049 装箱问题
    最长上升子序列(LIS)与最长公共子序列(LCS)
    求最大公约数与最小公倍数
  • 原文地址:https://www.cnblogs.com/james1207/p/3327585.html
Copyright © 2020-2023  润新知