The*_*Vet 5 ssh rsync amazon-ec2
免责声明:这可能与 Ubuntu 不完全相关,但由于某种原因 serverfault 在发布时给了我一个错误,而且我认为你们中的一些人之前可能已经偶然发现了这样的事情
我遇到了一个奇怪的问题。我有多个 ec2 实例正在管理,我不得不将一些隐藏文件从 Ubuntu 复制到 Amazon Linux 实例。
要走的路应该是 rsync AFAIK,因为 pem 文件在我的本地机器上 - Mac OS X 10.10.5 - 我做了我必须做的事情:
rsync -rave "ssh -i keyfile1.pem" ubuntu@firstmachineip:folder_inside_home/ local_folder/
Run Code Online (Sandbox Code Playgroud)
进而
rsync -rave "ssh -i keyfile2.pem" local_folder/ ec2-user@secondmachineip:
Run Code Online (Sandbox Code Playgroud)
两者都成功了。
问题是当再次 ssh 到第二台机器时(第一台很好)给了我模糊的
Permission denied (publickey).
Run Code Online (Sandbox Code Playgroud)
请注意,在 rsyncing 连接之前没有问题,即使密钥文件被损坏,我也从备份中恢复它chmod 600 keyfile2.pem并处理甚至尝试chmod 400 keyfile2.pem
ssh -vvv -i keyfile2.pem ec2-user@secondmachineip在确定指纹已知后,我还将保留输出的最后一部分:
debug1: Host 'secondmachineip' is known and matches the RSA host key.
debug1: Found key in /Users/thevet/.ssh/known_hosts:10
debug2: bits set: 494/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: keyfile2.pem (0x0), explicit
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: keyfile2.pem
debug1: read PEM private key done: type RSA
debug3: sign_and_send_pubkey: RSA *here goes the rsa*
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).
Run Code Online (Sandbox Code Playgroud)
知道到底发生了什么吗?我一窍不通。
提前致谢
小智 0
请注意,使用 -a 传输到根文件夹时,Rsync 可能存在保护功能或存在错误。
给定一个名为 Music 的本地文件夹,其中包含ow.txt
rsync -a Music/ root@134.209.12.183:/usr/
Run Code Online (Sandbox Code Playgroud)
将music文件夹中的cow.txt文件移至usr/,我仍然可以登录。
rsync -a Music/ root@134.209.12.183:/root/
Run Code Online (Sandbox Code Playgroud)
将cow.txt文件移动到/root/并且授权密钥不受影响,但我无法随后使用ssh@root134.209.12.183登录。
我不确定为什么会发生这种情况,并且在服务器上的日志中看不到任何可以解释它的内容。
但至少很容易避免这个问题
远程和本地服务器均运行 rsync 版本 3.1.1 协议版本 31
在 Ubuntu 16.04 上
| 归档时间: |
|
| 查看次数: |
2649 次 |
| 最近记录: |