zoukankan      html  css  js  c++  java
  • Linux

    SUMMARY:
    two server : A , B
    source server : A
    destination server : B
    the steps of migrate data from A to B without password.
    (1) generate A public key.
    (2) copy A's public key to B.
    (3) login A remote B without password to copy file. // NOTES : if want to login B to remote A , need to install B's public key to A.

    DETAIL:
    1、login source server 'A' with root create usergroup and user which user have not password.

    //create usergroup
    # groupadd goodmood
    //create user
    # useradd -d /home/goodmooduser -m -g goodmood goodmooduser
    //give user and usergroup to directory and recursive.
    # chown -R goodmooduser:goodmood /home/goodmooduser

    2、login destination server 'B', do same step as step1.

    3、login source server 'A', generate public key.

    # cd /opt/SSHtectia/util/
    # ls
    # ./generate_keys goodmooduser
    # cd /etc/opt/SSHtectia/keys/goodmooduse
    # cat id_rsa_2048_a.pub

    4、login destination server 'B', do same step as step3.

    5、install the public key of source server 'A' to destination server 'B'

    # cd /etc/opt/SSHtectia/keys
    # ls
    # cd goodmooduser
    # vi goodmooduser@A.pub // parse 'A' public key
    # vi authorization //add below script to this file.
    Key goodmooduser@A.pub
    Options command="eval $SSH_ORIGINAL_COMMAND",allow-from="A.nam.nsroot.net"

    6、login source server 'A' with root, then execute below steps without password, copy file or directory from source server /Adirectory to destination server /Bdirectory

    su - goodmooduser
    sftp goodmooduser@B.nam.nsroot.net 
    put /Adirectory /Bdirectory 
    exit
  • 相关阅读:
    LeetCode——二叉树中的最大路径和
    LeetCode——验证回文串
    LeetCode——word-ladder*
    LeetCode——最长连续序列
    3G? 2G? 2.5G? 4G? 与 WIFI, GPRS,CDMA 3G无线上网
    GSM、GPRS、EDGE、2G、3G与WAP的关系
    3G 2G GPRS 1G的概念
    那些精华博客
    单片机系统与标准PC键盘的接口模块设计
    以多个实例方式打开Notepad++
  • 原文地址:https://www.cnblogs.com/liupuLearning/p/6008630.html
Copyright © 2011-2022 走看看