user2035039
user2035039

Reputation: 971

How does editing a remote file work?

I was wondering how editing a remote file without downloading it to the local computer actually works in detail. After using google and reading some posts I learned that this is possible using the FTP or SSH protocol.

I assume that it's up to a special client application to set up a TCP/IP socket connection to a server, but what is going on after this is done?

Who needs to implement the protocol and how does another application that opens a remote file gain the data that it needs?

Upvotes: 0

Views: 501

Answers (3)

user2284545
user2284545

Reputation:

The application would download the whole file locally, open it, make changes and upload the whole file again. A classic example is WinSCP where you can 'edit' a remote file. The application (WinSCP) knows which protocol to use (FTP/FTPS/SFTP etc) and knows the parameters to be used (e.g. remote directory to upload the file to, username, password, port etc). Even if a file is large the whole file must be downloaded in order to me modified.

There appears to be no way of doing partial file updates in FTP, SFTP. HTTP or SCP. Infact there is no well known open source protocol to do this. If there is an implementation out there it has to proprietary.

Upvotes: 0

dave4420
dave4420

Reputation: 47062

The Wikipedia articles on FTP and SFTP seem reasonably good and provide links to the RFCs if you want to investigate further.

Who needs to implement the protocol and how does another application that opens a remote file gain the data that it needs?

You don't say which language your program will be written in, but there are surely suitable ftp and sftp libraries available for most of them.

If your program is running on Linux / OS X / other BSD you could even get away with calling the ftp/sftp programs.

Upvotes: 0

Nickolay Olshevsky
Nickolay Olshevsky

Reputation: 14160

SFTP protocol (do not mix it with FTP/FTPS), which works over the SSH, allows per-block access to the remote file. And it will work with almost any SSH server (where sftp subsystem is allowed).

For instance, in this way works SFTP Net Drive application, which mounts remote server's filesystem as Windows drive.

Upvotes: 3

Related Questions