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
  • 相关阅读:
    Scala入门基础1
    LitePal数据库的基本操作
    Android操作SQLate数据库
    Android广播的使用(自定义广播和本地广播)
    Android广播的使用(动态注册和静态注册)
    Android碎片的使用
    linux--硬链接与软连接
    linux下python环境的搭建
    系统时间的修改
    linux命令--文件和目录管理
  • 原文地址:https://www.cnblogs.com/liupuLearning/p/6008630.html
Copyright © 2011-2022 走看看