<p>This is a great question as some of the terminology can be very confusing - particularly surrounding the (unfortunate) use of &quot;SFTP&quot; to describe multiple similar technologies.</p>
<h2>Will the real SFTP please stand up</h2>
<p>This comes mainly from the fact, that <a href="https://www.rfc-editor.org/rfc/rfc913" rel="nofollow noreferrer">RFC 913</a> defines one SFTP protocol, the &quot;<a href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#Simple_File_Transfer_Protocol" rel="nofollow noreferrer">Simple File Transfer Protocol</a>&quot; which offers no encryption and went largely unadopted, with users favoring TFTP and FTP depending on their needed application.</p>
<h2>Since the <a href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#Simple_File_Transfer_Protocol" rel="nofollow noreferrer">FTP</a> protocol, defined in <a href="https://www.rfc-editor.org/rfc/rfc1738" rel="nofollow noreferrer">RFC 1738</a> in 1985 is completely encrypted and packet sniffers are able to dumping plaintext passwords from this protocol, Some thought that it would be a good idea to secure this protocol by implementing FTP over an SSL connection. In <a href="https://en.wikipedia.org/wiki/FTPS#Explicit" rel="nofollow noreferrer">1997 a mechanism for doing that was released</a> in <a href="https://www.rfc-editor.org/rfc/rfc2228" rel="nofollow noreferrer">RFC 2228</a> which often was referred to as <a href="https://en.wikipedia.org/wiki/FTPS" rel="nofollow noreferrer">SFTP</a>.<br>
<br>
<br>
Meanwhile, back at the ranch...</h2>
<p>Meanwhile, a similar security issue was occurring around the telnet protocol - passwords and sensitive information were unencrypted and subject to sniffing. In response, <a href="https://en.wikipedia.org/wiki/Secure_Shell#Version_1.x" rel="nofollow noreferrer">SSH-1 was released in 1995</a> which provided an encrypted equivelent to telnet for use over network connections.</p>
<p>This protocol became very popular very quickly and before a formal specification allowing for FTP over SSH was released, users of the SSH protocol had implemented a version of <a href="https://en.wikipedia.org/wiki/Rlogin#rcp" rel="nofollow noreferrer">BSDs rcp (remote copy)</a> over SSH. This protocol was extremely limited however, which led to a revision in SSH - SSH2 which added an SSH File Transfer Protocol (not to be confused with <a href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#FTP_over_SSH" rel="nofollow noreferrer">FTP over SSH</a>, <em>another</em> SFTP) because, according to wikipedia:</p>
<blockquote>
<p>Compared to the SCP protocol, which only allows file transfers, the SFTP protocol allows for a range of operations on remote files which make it more like a remote file system protocol. An SFTP client's extra capabilities include resuming interrupted transfers, directory listings, and remote file removal.</p>
</blockquote>
<p>And In fact, the IETF set up a working group to codify a formal standard for SSH-2 (released as <a href="https://www.rfc-editor.org/rfc/rfc4251" rel="nofollow noreferrer">RFC 4251</a>) but</p>
<blockquote>
<p>Eventually, development stalled as some committee members began to view SFTP as a file system protocol, not just a file access or file transfer protocol, which places it beyond the purview of the working group.</p>
</blockquote>
<p>And eventually <a href="https://en.wikipedia.org/wiki/SSHFS" rel="nofollow noreferrer">SSHFS</a> was released as just that.</p>
<h2>Conclusion</h2>
<p>So the answer is a bit complicated.</p>
<p>SSH and SFTP and SCP <em>could</em> be regarded as completely different protocols depending on <em>which</em> SFTP you are referring to and which version of the SSH protocol you are referring to. Yet, the command for actually doing a file transfer remained &quot;scp&quot; even after the SFTP and SSH-2 protocol was developed. If one is referring to SSH-2 however, these could arguably all be considered the <em>same</em> protocol.</p>
<p>Side note: SSH was released by Tatu Ylönen of the Helsinki University of Technology in 1995. As <a href="https://en.wikipedia.org/wiki/Linus_Torvalds" rel="nofollow noreferrer">Linus Torvalds</a> released Linux in 1991 as a student at the University of Helsinki until 1996, it was kismet that SSH would be so popular and widely used in Linux.</p>

CC BY-SA 3.0
2018-02-01T23:08:46.007Z
2018-02-01T23:08:46.007Z
2021-10-07T07:34:52.683Z
James Shewey
<p>Yes, Ansible transfers packaged task file to remote host and executes it there. Still, the process can be different with pipelining mode.</p>

<p>This is how task execution looks like in general (without pipelining):</p>

<ul>
<li>Generate Python-file with module and its parameters for remote execution</li>
<li>Connect via SSH to detect remote user home directory</li>
<li>Connect via SSH to create temporary work directory</li>
<li>Connect via SSH to upload Python-file via SFTP</li>
<li>Connect via SSH to execute Python-file and cleanup temp dir</li>
<li>Get module's result from SSH standard output</li>
</ul>

CC BY-SA 3.0
2018-02-01T18:12:02.547Z
So if my control node has Python2 installed and ansible installed using pip
and my remote nodes have only Python3, will the ansible also work flawlessly.
Also the other way round, when Control Node has only Python3 and Remote nodes Python2?
Gaurav Parashar
CC BY-SA 3.0
2018-02-01T18:37:00.070Z
Your mileage may vary. Ansible is not yet 100% compatible with Python3, but some users state that they have no issues with Python3.
Konstantin Suvorov
CC BY-SA 3.0
2018-02-01T18:00:22.957Z
2018-02-01T18:00:22.957Z
Konstantin Suvorov
<p>I am a little confused as to what is the protocol that Ansible uses for communication between  Controller node and Managed Remote nodes.</p>

<p>I believed that it was "SSH" protocol.</p>

<p>However, the official documentation mentions this
"On the managed nodes, you need a way to communicate, which is normally ssh. By default this uses sftp. If that’s not available, you can switch to scp in ansible.cfg"</p>

<p>I am a little confused as I used to believe SSH and SFTP and SCP are completely different protocol.
AFAIK,
SFTP is used to securely transfer files and SCP is for secure copy. This may be over SSH connection, but why would ansible use SFTP or SCP?</p>

<p>Is it about transferring some files/python modules using these protocols?
If yes, what files are getting transferred actually? </p>

<p>Kindly Excuse me if this question sounded silly, nevertheless any elaborate response would be much appreciated.</p>

<ansible>
Ansible communication medium
Gaurav Parashar
# Ansible communication medium

(Asked by: username_0 on 2018-02-01)

I am a little confused as to what is the protocol that Ansible uses for communication between Controller node and Managed Remote nodes.

I believed that it was "SSH" protocol.

However, the official documentation mentions this
"On the managed nodes, you need a way to communicate, which is normally ssh. By default this uses sftp. If that’s not available, you can switch to scp in ansible.cfg"

I am a little confused as I used to believe SSH and SFTP and SCP are completely different protocol.
AFAIK,
SFTP is used to securely transfer files and SCP is for secure copy. This may be over SSH connection, but why would ansible use SFTP or SCP?

Is it about transferring some files/python modules using these protocols?
If yes, what files are getting transferred actually?

Kindly Excuse me if this question sounded silly, nevertheless any elaborate response would be much appreciated.

**Tags:** ansible


---

## 2 answers

### Answer by username_1 on 2018-02-01. Score: 3

This is a great question as some of the terminology can be very confusing - particularly surrounding the (unfortunate) use of "SFTP" to describe multiple similar technologies.

## Will the real SFTP please stand up

This comes mainly from the fact, that [RFC 913](https://www.rfc-editor.org/rfc/rfc913) defines one SFTP protocol, the "[Simple File Transfer Protocol](https://en.wikipedia.org/wiki/File_Transfer_Protocol#Simple_File_Transfer_Protocol)" which offers no encryption and went largely unadopted, with users favoring TFTP and FTP depending on their needed application.

## Since the [FTP](https://en.wikipedia.org/wiki/File_Transfer_Protocol#Simple_File_Transfer_Protocol) protocol, defined in [RFC 1738](https://www.rfc-editor.org/rfc/rfc1738) in 1985 is completely encrypted and packet sniffers are able to dumping plaintext passwords from this protocol, Some thought that it would be a good idea to secure this protocol by implementing FTP over an SSL connection. In [1997 a mechanism for doing that was released](https://en.wikipedia.org/wiki/FTPS#Explicit) in [RFC 2228](https://www.rfc-editor.org/rfc/rfc2228) which often was referred to as [SFTP](https://en.wikipedia.org/wiki/FTPS). Meanwhile, back at the ranch...

Meanwhile, a similar security issue was occurring around the telnet protocol - passwords and sensitive information were unencrypted and subject to sniffing. In response, [SSH-1 was released in 1995](https://en.wikipedia.org/wiki/Secure_Shell#Version_1.x) which provided an encrypted equivelent to telnet for use over network connections.

This protocol became very popular very quickly and before a formal specification allowing for FTP over SSH was released, users of the SSH protocol had implemented a version of [BSDs rcp (remote copy)](https://en.wikipedia.org/wiki/Rlogin#rcp) over SSH. This protocol was extremely limited however, which led to a revision in SSH - SSH2 which added an SSH File Transfer Protocol (not to be confused with [FTP over SSH](https://en.wikipedia.org/wiki/File_Transfer_Protocol#FTP_over_SSH), *another* SFTP) because, according to wikipedia:

> Compared to the SCP protocol, which only allows file transfers, the SFTP protocol allows for a range of operations on remote files which make it more like a remote file system protocol. An SFTP client's extra capabilities include resuming interrupted transfers, directory listings, and remote file removal.

And In fact, the IETF set up a working group to codify a formal standard for SSH-2 (released as [RFC 4251](https://www.rfc-editor.org/rfc/rfc4251)) but

> Eventually, development stalled as some committee members began to view SFTP as a file system protocol, not just a file access or file transfer protocol, which places it beyond the purview of the working group.

And eventually [SSHFS](https://en.wikipedia.org/wiki/SSHFS) was released as just that.

## Conclusion

So the answer is a bit complicated.

SSH and SFTP and SCP *could* be regarded as completely different protocols depending on *which* SFTP you are referring to and which version of the SSH protocol you are referring to. Yet, the command for actually doing a file transfer remained "scp" even after the SFTP and SSH-2 protocol was developed. If one is referring to SSH-2 however, these could arguably all be considered the *same* protocol.

Side note: SSH was released by Tatu Ylönen of the Helsinki University of Technology in 1995. As [Linus Torvalds](https://en.wikipedia.org/wiki/Linus_Torvalds) released Linux in 1991 as a student at the University of Helsinki until 1996, it was kismet that SSH would be so popular and widely used in Linux.


---

### Answer by username_2 on 2018-02-01. Score: 1

Yes, Ansible transfers packaged task file to remote host and executes it there. Still, the process can be different with pipelining mode.

This is how task execution looks like in general (without pipelining):

* Generate Python-file with module and its parameters for remote execution
* Connect via SSH to detect remote user home directory
* Connect via SSH to create temporary work directory
* Connect via SSH to upload Python-file via SFTP
* Connect via SSH to execute Python-file and cleanup temp dir
* Get module's result from SSH standard output

> **Comments:**
> **username_0**: So if my control node has Python2 installed and ansible installed using pip and my remote nodes have only Python3, will the ansible also work flawlessly. Also the other way round, when Control Node has only Python3 and Remote nodes Python2?  
> **username_2**: Your mileage may vary. Ansible is not yet 100% compatible with Python3, but some users state that they have no issues with Python3.  

---

