Home Linux Commands How to Edit Files Over a Network Using FTP, SCP and HTTP

How to Edit Files Over a Network Using FTP, SCP and HTTP

File modification is an OS routine inevitable to all Linux users. No one can avoid it. Every Linux user (from beginner to pro) has a preferred text editor for file management tasks like their creation, editing, and modification.

However, what is the procedure for editing a file on a remote machine? Your first response will be to log in to the remote machine via network protocols like SSH, navigate to the targeted file location, open it, edit the file, close it, and log out of the remote machine. While these stated steps do work, there are efficient ways of achieving the stated objective.

This article is here to explore a more efficient approach to directly editing a file on a remote machine over a network while borrowing the implementations of ftp, scp, rcp, and http network protocols.

[ You might also like: Difference Between SFTP, SCP, and FISH Protocols ]

Problem Statement

We need an existing file on a remote machine to access and edit over a network and our remote machine IP address is 192.168.100.29. Our remote machine will also have a file named some_file.txt on the absolute path /home/ubuntu/Documents/some_file.txt which we will try to edit remotely via Vim editor.

The command syntax to follow to successfully edit files over a network is:

$ vim protocol://user@remote_machine/path/to/targeted/file

Depending on how you have configured your network access, you might be asked for user credentials for authentication purposes.

Editing Files Over a Network using FTP

Here, it is advisable to go with secure FTP (sFTP) over FTP.

$ vim sftp://[email protected]//home/ubuntu/Documents/some_file.txt
Edit Files Using sFTP in Linux
Edit Files Using sFTP in Linux

Press [Enter] to access the file, use i key to edit it, use :w save the file and use :q to close the Vim.

Editing Files Over a Network using SCP

To edit files using the scp command over a network on a remote Linux machine, use:

$ vim scp://[email protected]//home/ubuntu/Documents/some_file.txt
Edit Files Using Scp in Linux
Edit Files Using Scp in Linux

Editing Files Over a Network using RCP

To edit files using the RCP command over a network on a remote Linux machine, use:

$ vim rcp://[email protected]//home/ubuntu/Documents/some_file.txt
Edit Files Using Rcp in Linux
Edit Files Using Rcp in Linux

Editing Files Over a Network using HTTP

To edit files using the http protocol over a network on a remote Linux machine, use:

$ vim https://[email protected]//home/ubuntu/Documents/some_file.txt
Edit Files Using Http in Linux
Edit Files Using Http in Linux

For some reason, both HTTP and HTTPS network protocols fail the test of “editing files over a network”. We however have full proof of using FTP (sFTP), SCP, and RCP protocols.

It is now much easier to edit files on the remote machine via Vim editor installed on the host machine.

Ravi Saive
I am an Experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies. Founder of TecMint.com, LinuxShellTips.com, and Fossmint.com. Over 150+ million people visited my websites.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.