Edit files on a remote server without a GUI
The easiest way to edit files on a remote server without a GUI is to SSH in and run a terminal editor there: ssh you@server, then nano file, vim file, or any editor you installed. The editor runs on the server and draws in your terminal, so nothing extra is needed on your machine.
If you would rather use a local editor, you have three other options:
- mount the remote folder with
sshfs, - let Vim edit over
scp://, - copy files back and forth with
scp.
Option 1: run an editor on the server (recommended)
Section titled “Option 1: run an editor on the server (recommended)”ssh you@servernano /etc/nginx/nginx.conf # or vim, or micro, or skinkPros: language servers, git and builds run where the code is. There is nothing to sync, and it works from any terminal, even a phone.
Cons: you use whatever editor is installed, or install your own.
Install a fuller editor without root
Section titled “Install a fuller editor without root”Most servers have vi, and many have nano. To get more, install an editor into your home directory. For Skink:
curl -fsSL https://skink.cc/install.sh | shskink ~/app # file tree on the left, the project's files in tabsskink src/main.rs:120 # open at line 120Option 2: mount the remote folder with sshfs
Section titled “Option 2: mount the remote folder with sshfs”mkdir -p ~/mnt/serversshfs you@server:/srv/app ~/mnt/server# edit with any local editor, then:fusermount -u ~/mnt/server # Linux; on macOS: umount ~/mnt/serverPros: your local editor and its config.
Cons: every file read goes over the network, so project-wide search, git and language servers get slow on large trees. Those tools also run against the mounted copy, not on the server. On macOS it needs macFUSE.
Option 3: let Vim edit over scp
Section titled “Option 3: let Vim edit over scp”Vim’s netrw can open remote files directly:
vim scp://you@server//etc/hosts # two slashes: absolute pathvim scp://you@server/notes.txt # relative to your home directorySaving writes the file back with scp. It is good for single files, but there is no project view and no remote tooling.
Option 4: copy, edit, copy back
Section titled “Option 4: copy, edit, copy back”scp you@server:/srv/app/config.yml .$EDITOR config.ymlscp config.yml you@server:/srv/app/config.ymlSimple and safe for one file, error-prone for more than that.
How do I edit a root-owned file on the server?
Section titled “How do I edit a root-owned file on the server?”Use sudoedit. It copies the file, opens it in your EDITOR, and writes it back as root:
EDITOR=nano sudoedit /etc/ssh/sshd_configIn Skink you can also open the file as yourself and save. On “permission denied” Skink offers sudo: it runs sudo tee in a terminal tab, where sudo can ask for your password, and closes the tab once the file on disk matches.
How do I copy text from the remote editor to my laptop?
Section titled “How do I copy text from the remote editor to my laptop?”With a terminal editor over SSH, the editor’s clipboard is the server’s, not yours. The fix is OSC 52: the editor sends the copied text as an escape sequence, and your terminal puts it on your local clipboard.
Skink does this on every copy by default. Neovim detects it; Vim, Micro and Helix need a setting or package. Full guide: copy and paste over SSH.
Keep the session alive with tmux
Section titled “Keep the session alive with tmux”Network drops happen. Run your editor inside tmux on the server:
ssh you@servertmux new -A -s work # attach if it exists, else createskink ~/appIf the connection drops, SSH back in and run the same tmux command. Add set -g mouse on and set -g set-clipboard on to ~/.tmux.conf so the mouse and OSC 52 pass through.
If tmux or your terminal eats a Skink key, press Ctrl+E and type its command instead, for example findinfiles for project search. See typed commands.
What Skink gives you on a remote server
Section titled “What Skink gives you on a remote server”- One static binary (musl on Linux), installed without sudo, about 8 MB of RAM when idle.
- Modeless editing with familiar keys: Ctrl+S save, Ctrl+Q quit, Ctrl+F find.
- Mouse support through SSH and tmux.
- LSP, tree-sitter colours, project search (Alt+S), git gutter and git panel, all running on the server.
- Terminal tabs (F12) for logs, builds,
systemctlor an AI agent next to the file. - Atomic saves (never half a file) and backups of unsaved edits, so after a crash or dropped connection Skink offers to recover them.
More: the best terminal editor for SSH, Skink vs VS Code Remote SSH, SSH and remote editing guide.