zoukankan      html  css  js  c++  java
  • 使用 scp命令免登陆

    多台服务器之间互相拷贝文件一般常用scp命令但是让人困扰的是还要输入密码,

    能不能不输入密码直接拷贝?

    所幸方法是有的,ssh服务是支持免登陆的,不过需要密钥文件

    方法如下:

    [root@WebServer3 ~]# 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:
    a2:1d:43:32:26:06:68:48:d5:62:16:6d:a2:c7:53:8c root@WebServer3

    输入命令后直接都按回车就行。

    第一提示是密钥保存位置

    Enter file in which to save the key (/root/.ssh/id_rsa):

    直接回车保存到默认地方 /root/.ssh/id_rsa

    第二个提示是输入一个不同于你的password的密码。直接按回车,不输入密码,保持密码为空。

    其中公共密钥保存在 ~/.ssh/id_rsa.pub 
    私有密钥保存在 ~/.ssh/id_rsa 

    拷贝密钥文件到目标服务器

    [root@WebServer3 ~]#scp ~/.ssh/id_rsa.pub 192.168.0.23:/root/.ssh/authorized_keys

    配置完毕,你在这台机器上用scp ssh sftp 命令访问目标机器的时候就不用输入密码了

    参考文档:http://www.chinaunix.net/old_jh/4/343905.html

  • 相关阅读:
    第13组 Beta (2/6)(俞子君)
    第13组 Beta (1/6)(俞子君)
    第13组 Alpha (6/6)(俞子君)
    第13组 Alpha (5/6)(俞子君)
    第13组 Alpha (4/6)(俞子君)
    第13组 Alpha (3/6)(俞子君)
    第13组 Alpha (2/6)(俞子君)
    番茄蛋花汤口罩识别系统汇报
    β(56/6)
    β(34/6)
  • 原文地址:https://www.cnblogs.com/jikexianfeng/p/5813718.html
Copyright © 2011-2022 走看看