从Bitbucket进行SSH部署.禁用密码



所以基本上我的设置是我在远程服务器上创建一个ssh对,然后将pub密钥复制到bitbucket和服务器的authorized_keys文件。

当我在 Bitbucket 上运行部署时,我仍然被拒绝权限。

在管道中使用的任何 SSH 密钥都不应具有密码。

假设这与它有关,即使我用空白密码创建了 ssh 对,我的sshd_config文件也有:

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

我应该将其更改为是吗?

Bitbucket的文档说我应该ssh-copy-id -i my_ssh_key user@host,但这对我来说没有意义,因为所有ssh gen要么发生在远程上,要么发生在Bitbucket本身中。

不知道为什么这不更清楚。

编辑:这是位桶构建上的错误:

+ cat ./deploy.sh | ssh username@remote.com
Pseudo-terminal will not be allocated because stdin is not a terminal.
Warning: Permanently added the RSA host key for IP address ‘XXX.XXX.XX.XX’ to the list of known hosts.
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).

以下是我sshd_config的一些价值观:

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile     %h/.ssh/authorized_keys

好的,知道了。出于某种原因,我的 ssh 逻辑倒置了。我在 Bitbucket 中重新创建了 ssh 密钥对,将公钥添加到远程服务器的 ~/ssh/authorized_keys 文件中,然后......我保证该文件的权限设置为 600 .修复该权限后,我有了第一个成功的构建。希望这对某人有所帮助。

最新更新