2

(no alternate suggestions like vim --servername, or vim over ssh, or "just use ssh", or nfs, sshfs please. Also I prefer to avoid more elaborate incarnations of netcat like ncat)

I'd like to edit my text files that exist on another computer over a network, and know that it's not so straightforward using netcat. But I'm sure it's possible given a deeper understanding of netcat. I'd like to achieve that deeper understanding.

I know how to create my own REST service with netcat using pipes and fifo's. I also know you can expose your entire bash shell over netcat (yes it's dangerous), but it won't display the prompt. Yet it does display the output of a bash command back on the client.

What must be done to get a text editor (like vim, pico, nano, emacs) to work over a network for both reading and writing?

Sridhar Sarnobat
  • 25,183
  • 12
  • 93
  • 106

1 Answers1

1

From vim doc:

Editing files over a network                *new-network-files*
----------------------------

Files starting with scp://, rcp://, ftp:// and http:// are recognized as
remote files.  An attempt is made to access these files with the indicated
method.  For http:// only reading is possible, for the others writing is also
supported.  Uses the netrw.vim script as a standard "plugin". |netrw|

Another tutorial: http://vim.wikia.com/wiki/Edit_remote_files_locally_via_SCP/RCP/FTP


# open a remote file
vim scp://remote-computer:22//tmp/file.txt

# ... EDIT ...

# write it back (run in vim)
:Nwrite
kev
  • 155,172
  • 47
  • 273
  • 272
  • Can it be done with telnet? My file doesn't need to be secured. – Sridhar Sarnobat Aug 16 '14 at 00:54
  • @Sridhar-Sarnobat The doc didn't mention `telnet`, I'm not sure. – kev Aug 16 '14 at 00:57
  • I tried `vim scp://...` and it prompts for my password but then opens a blank file. Before the password prompt it says `:!scp -q -P 2222 'username@host.domain.com:/new.mwk' '/tmp/vEN222R/0.mwk'`. After entering a password it says `"/tmp/vEN222R/0.mwk" [New File] Press ENTER or type command to continue` What am I doing wrong? – Sridhar Sarnobat Aug 21 '14 at 17:35
  • Oh wait, it looks like symbolic links are the problem. If i give a real path it works. – Sridhar Sarnobat Aug 21 '14 at 17:39