Back to blog

Edit remote config files over SFTP without vim, nano, or a mount

December 1, 2026 7 min read Kubexer Team
SFTPRemote EditorConfig FilesSSH

A lot of server work is changing a few lines in a text file: an nginx server block, a systemd unit, a .env, a cron entry. The usual tools are fine until they are not. vim on a high-latency link makes every keystroke a round trip. nano is friendlier but still lives inside the terminal. Mounting the server with sshfs or a desktop SFTP client and opening the file in your local editor works, but it means one more tool, and most of those flows have no idea whether someone else changed the file while you were editing it.

Kubexer Terminal's remote file editor is a Pro feature that sits in between: open the file from the SFTP browser, edit it in an editor tab next to your terminal, and save it straight back over SFTP.

Opening a file

Open the SFTP browser for a host (the same host, identity and jump chain your terminal uses). Then:

  • double-click a text file,
  • select it and press Enter, or
  • right-click it and choose Edit.

The file opens in a new editor tab whose header shows host:/path. Next to it are badges for the detected language, the line endings (LF or CRLF), the encoding (UTF-8 or UTF-8 BOM) and the file size.

The editor is CodeMirror 6, with line numbers, bracket matching, undo history and search. The language is chosen from the file name, by extension or by well-known names such as Dockerfile, and the matching syntax mode loads on demand. Files with no match open as Plain text.

Editing and saving

Edit as you would locally. An amber dot marks unsaved changes. Cmd+F (Ctrl+F) opens find and replace. Cmd+S (Ctrl+S) or the Save button writes the file back. Closing a tab with unsaved changes asks whether to save, discard or keep editing.

The file's text lives only in memory. Nothing is written to your local disk, so there is no temp copy of a secrets file left behind in a downloads folder.

How the save is written

Where it can, the editor saves atomically: it writes a temporary file next to the original and renames it into place, so a process reading the file never sees half of it. That is only done when the file belongs to the user you logged in as and is not a symlink or hard link, because a rename would otherwise change ownership or break the link. In those cases it writes in place. If an atomic save cannot complete, it falls back to writing in place; it never deletes the original first. The file's permission bits are preserved either way.

Line endings and a UTF-8 byte-order mark, if the file had one, are kept as they were. A Windows-style config stays CRLF.

When someone else changed the file

When you open a file the editor records its modification time and size. On save it checks them again. If either changed, you get a dialog titled File changed on the server with three choices:

  • Overwrite: replace their version with yours.
  • Reload: load their version and discard your changes.
  • Cancel: keep editing, for example to copy your change somewhere first.

If the file was deleted while you were editing, the choice is Recreate or cancel. This check is based on modification time and size, not a content lock, so it catches the ordinary case of a colleague or a deploy changing the file; it is not a distributed lock.

Permissions and read-only files

If the file's mode bits and owner suggest your login cannot write it, the editor opens it read-only with a banner: "Read-only — this login doesn't appear to have write permission on this file." That is a heuristic. Group membership or ACLs may still allow the write, so the banner has Edit anyway; the server will refuse the save if the guess was right.

The editor does not elevate privileges. For a root-owned file such as /etc/nginx/nginx.conf you need to connect as a user that can write it, or edit a copy and move it into place with sudo in the terminal pane next door:

sudo cp /tmp/nginx.conf /etc/nginx/nginx.conf
sudo nginx -t && sudo systemctl reload nginx

Limits

  • 5 MB per file. Larger files are refused with a message suggesting you download them instead. Logs belong in less or tail, not an editor.
  • UTF-8 only. Binary files and text in other encodings, such as Latin-1, are refused rather than risk corrupting them on save.
  • Regular files only. Folders, devices, FIFOs and sockets cannot be opened.
  • One file per tab, no project view, no auto-save. Editor tabs cannot be split like terminal panes.
  • If the SFTP connection drops, your text stays in the editor and a banner tells you to open a new SFTP tab to that host and save again.

A typical flow

  1. Open a terminal and an SFTP tab to the host.
  2. In the SFTP browser, go to /etc/systemd/system and double-click app.service.
  3. Change Restart=on-failure to Restart=always and press Cmd+S.
  4. In the terminal tab run sudo systemctl daemon-reload && sudo systemctl restart app.

On the free plan, double-click and Enter download the file instead, and Edit shows a Pro badge.

Try it

The remote file editor is part of Pro in Kubexer Terminal. For the file browser itself, see SFTP without leaving your terminal.