首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ssh: Amazon-EC2和Azure中的pgbarman设置问题

ssh: Amazon-EC2和Azure中的pgbarman设置问题
EN

Stack Overflow用户
提问于 2014-02-10 08:59:25
回答 1查看 629关注 0票数 0

我有两个服务器,一个在Amazon实例(t1.media)中,另一个在Microsoft (媒体)实例中。这两台服务器具有相同的配置Ubuntu LTS 12.04.1, 64-bit arch,运行PostgreSQL 9.1。我需要在Azure上设置灾难恢复系统(为亚马逊实例的数据库打开WAL存档,用于通过pgbarman进行特定的数据备份计划)。

在通过pgbarman博士的过程中,强制要求之一就是,

  • 在没有密码验证/提示的情况下,两端都需要ssh通信。(Pgbarman有一个先决条件,让postgres@amazon直接到barman@azure,反之亦然.)看,从Pgbarman开始)。

但是,我记录这些实例的复杂性如下:

  • EC2有一个.pem文件,无需任何密码验证即可访问该文件:ssh -i my-pem-file.pem ubuntu@my-instance-public-ip-region.compute.amazonaws.com
  • Azure没有.pem文件。相反,可以使用密码机制( ssh azure-user@app.cloudapp.net )访问它。

不过,为了启用我所做的设置,

  • 我通过来自postgres-barman.pubssh-keygen创建了一个密钥文件barman@azure
  • 通过ssh-copy-id -i ubuntu@amazon将此文件传输到亚马逊(有关更多信息,请参见下面的链接)

我的问题是:

  1. ssh Azure to Amazon:
代码语言:javascript
复制
- I cannot transfer this file to `postgres` user:  `cat postgres-barman.pub | ssh -i my-pem-file.pem postgres@amazon 'cat >> .ssh/authorized_keys'` but if I change destination's user to `ubuntu`, the file gets copied. 
- After transferring the file (via `ubuntu` user), I try to do this: `ssh postgres@amazon`. It fails. 

  1. ssh Amazon to Azure
代码语言:javascript
复制
- The same file is now residing on both sides. Still, if I issue `ssh barman@azure`, it asks for a password authentication (which is set to `yes` in `/etc/ssh/sshd_config` of the Azure instance). I cannot proceed with this die to `barman` pre-req.

  1. 亚马逊只允许通过ssh用户进行ubuntu编辑。我需要为postgres用户启用此功能。这能办到吗?

注意:亚马逊在其PasswordAuthentication文件中将no设置为no

参考文献:

  • ssh-拷贝-id:
    • Ubuntu SSH
    • 使用ssh-keygen & ssh-copy-id执行不需要密码的SSH登录的3个步骤
    • SSH in-Linux

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-02-11 08:16:09

不管怎么说,我已经解决了。

我没有正确地做配置。我就是这么做的。

在亚马逊:

代码语言:javascript
复制
ubuntu@amazon~$ sudo -s
root@amazon~$ passwd postgres
Enter new UNIX Password:
ubuntu@amazon~$ su - postgres
Password:
postgres@amazon~$ ssh-keygen -t rsa
postgres@amazon~$ scp .ssh/id_rsa.pub barman@azure-ip:~/.ssh/

在蔚蓝上:

代码语言:javascript
复制
ubuntu@azure~$ sudo -s
root@azure~$ passwd barman
Enter new UNIX Password:
ubuntu@azure~$ su - barman
Password:
barman@azure~$ cd .ssh
barman@azure~$ cat .ssh/id_rsa.pub >>~/.ssh/authorized_keys

现在,ssh到蔚蓝:

代码语言:javascript
复制
postgres@amazon:~$ ssh barman@azure

现在,对Azure重复同样的话。

唯一的区别是,关键转移到亚马逊并没有发生通过scp。因此,我在barman@azure的/.ssh文件夹中复制了/.ssh中的内容,粘贴在postgres@amazon的.ssh/authorized_keys文件中并保存了它。

现在,ssh转到amazon:

代码语言:javascript
复制
barman@azure:~$ ssh postgres@amazon

它起作用了!谢谢你的建议!

参考文献:

现在要担心酒保的事了。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21672696

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档