Ubuntu – Editing files on server through SSH

editingfilesserversshtext-editor

I'm working on a web application and all of it's files are on a linux server, which I am accessing through SSH. Is there a way to edit these files in a text editor other than vim or nano through SSH, because there is a whole team of us that has to work on this project (front-end, DB management etc.), and we prefer working on it while it's on the server. I'm talking about editing files over SSH on text editors along the line of Sublime Text or Atom.

Best Answer

If you already have ability to ssh onto that remote host then on local ubuntu machine issue

sudo apt-get install sshfs

mkdir ~/local_mountpointdir  # create empty local live mirror of remote dir

sshfs remoteuserid@remotehost:/path/remote_dir  ~/local_mountpointdir

You are free to use any local editor to do live edits on any file living on that remote dir /path/remote_dir by editing the same filename found on your new local live mirror directory ... still on local machine issue

cd  ~/local_mountpointdir
ls -la   # you will see all files listed which live on remote host

Now just edit any file in ~/local_mountpointdir which will live real time auto sync all edits up to remote host dir ... when done just kill the local box pid running sshfs at which point the connection will be gone and so will the contents of ~/local_mountpointdir knowing they are safe up on remote host ... killall sshfs