大网数据广告活动
服务器运维问答

Is the SSH SFTP subsystem required on the managed nodes for Ansible to work?

· 52CE 我爱测

When I run: ansible all -a "/bin/echo hello" -u myuser I get back: mydomain.myhost.com | FAILED => failed to open a SFTP connection (Channel closed.) The SFTP subsystem is disabled on the managed node I'm trying to connect to. Is…

问题原文

原帖链接 · braveterry · CC BY-SA 3.0

When I run:

ansible all -a "/bin/echo hello" -u myuser

I get back:

mydomain.myhost.com | FAILED => failed to open a SFTP connection (Channel closed.)

The SFTP subsystem is disabled on the managed node I'm trying to connect to.

Is SFTP required on the managed nodes? The Ansible docs don't mention SFTP specifically: http://docs.ansible.com/intro_installation.html#managed-node-requirements

I tried setting this value in ansible.cfg:

scp_if_ssh=True

...but it had no effect. (Thanks to Fred the Magic Wonder Dog for the suggestion.)

I also ensured that my non-interactive shell doesn't produce any output as suggested here.

已采纳解答

原帖链接 · braveterry · CC BY-SA 3.0

Here's what I ended up doing:

  1. Copied /etc/ansible/ansible.cfg to ~/.ansible.cfg
  2. Edited ~/.ansible.cfg.
  3. Changed #scp_if_ssh = False to scp_if_ssh = True
  4. Added ssh_args = to [ssh_connection] section.
  5. Ran my command with -c SSH flag

Thanks to Fred the Magic Wonder Dog for pointing me in the right direction.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-03-14)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。