Rsync to Amazon Ec2 Instance

前端 未结 5 941
面向向阳花
面向向阳花 2020-12-07 18:52

I have an EC2 instance running and I am able to SSH into it.

However, when I try to rsync, it gives me the error Permission denied (publickey).

The command

5条回答
  •  有刺的猬
    2020-12-07 19:34

    After suffering a little bit, I believe this will help:

    I am using the below command and it has worked without problems:

    rsync -av --progress -e ssh /folder1/folder2/* root@xxx.xxx.xxx.xxx:/folder1/folder2
    

    First consideration:

    Use the --rsync-path

    I prefer in a shell script:

    #!/bin/bash
    
    RSYNC = /usr/bin/rsync
    
    $RSYNC [options] [source] [destination]
    

    Second consideration:

    Create a publick key by command below for communication between the servers in question. She will not be the same as provided by Amazon.

    ssh-keygen -t rsa
    

    Do not forget to enable permission on the target server in /etc/ssh/sshd_config (UBUNTU and CENTOS).

    Sync files from one EC2 instance to another

    http://ask-leo.com/how_can_i_automate_an_sftp_transfer_between_two_servers.html

    Use -v option for verbose and better identify errors.

    Third Consideration

    If both servers are on EC2 make a restraint by security group

    In the security group Server Destination:

    inbound: Source / TCP port 22 / IP Security (or group name) of the source server

提交回复
热议问题