ssh – How to Remotely Edit Files via SSH

editorssshvim

I have to edit some files placed on some server I could reach via ssh.

I would prefer to edit these files in customized vim on my workstation (I have not rights to change vim settings on remote server). Sometimes I would like to edit a file with sublime text or other GUI editor.

Of course, I can download these files, edit them locally and upload them back to server. Is there more elegant solution?

Best Answer

You could do this by mounting the remote folder as a file-system using sshfs. To do this, first some pre-requisites:

#issue all these cmds on local machine
sudo apt-get install sshfs
sudo adduser <username> fuse #Not required for new Linux versions (including Ubuntu > 18.04)

Now, do the mounting process:

mkdir ~/remoteserv    
sshfs -o idmap=user <username>@<ipaddress>:/remotepath ~/remoteserv

After this, just go into the mounted folder and use your own local customized vim.