If I were to edit files over an SSH connection, lets say either SSH'ing into the remote and editing files using Vim or using VSCode's remote development feature, are the files actually being transferred to the host machine (even if they are just being held in memory) and sent back after they have been changed? My fairly limited understanding of SSH would say that yes of course it would have to, but I haven't found anything to confirm this, maybe I am just not searching effectively. Unless there was a bunch of fancy infrastructure that had the remote rendering the files and sending those rendered buffers back to the host then it would have to just be sending the actual files because I don't think that is happening over just SSH(I think that that is what is happening with something like AWS workspaces?). This is being asked in the context of evaluating the security of editing files over SSH and having sensitive code on local machines.


It depends on the way each system uses SSH.

If you connect to a server using SSH and go to a terminal session and start vi, then the editing happens completely on the remote server. You only see a copy of the screen at your local machine.

I don't know all the details of VSCode remote development feature, but I see it creates a process on the remote machine, which acts as server for the Visual Studio Code process running on your computer. I think the server part opens the files at the remote server, and sends the contents to the editor, and vice versa.

Neither of these approaches sends the physical file to the client computer.

Another approach is used by desktop SFTP clients. They might have an option: "Edit file". In this case, the SFTP client downloads the file content to local disk and then starts the chosen editor to edit file on local disk.

Once the editor is closed, the SFTP client uploads the file to remote server.

And one more approach is full desktop remote access, for example VNC over SSH tunnel. In this case the graphical desktop from remote computer is shown at local computer. When you edit files there, all file operations happen at the remote server.

  • I am a bit confused by what you describe for the VSCode situation, which I understand you are just trying your best to guess at what is happening. When you say the server "opens the files at the remote server, and sends the contents to the editor," how is that not sending the actual file data to the client? – turtlemcnuggets Jun 15 at 19:30
  • Broadly put, all these methods send the data to the client machine, in one form or another. In one case it is terminal view of the editor, in another case it can be the file contents as-is, in third case it is the graphical representation of the editor. But yes, my statement of "send the actual data" was a bit inaccurate, I will update it. – Tero Kilkanen Jun 15 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.