Agentless SSH
A small, fast SSH file browser for VS Code. Nothing gets installed on the server. It talks plain SFTP, and when you switch user it talks to a POSIX shell.
- No server component. Unlike Remote-SSH, nothing is downloaded to or run on the host. Routers, old boxes and locked-down servers work too.
- Several sessions at once, including several sessions to the same host (for example one as yourself and one as
root).
- Switch user per session. After
sudo or su, the tree lists folders and the editor opens and saves files as that user. Owner and permissions of existing files are kept.
- Uses your
~/.ssh/config. Host aliases, HostName, User, Port, IdentityFile, IdentitiesOnly, IdentityAgent, ProxyJump and Include are supported.
- ssh-agent, keys (with passphrase), password, keyboard-interactive. Secrets are kept in memory only, so new sessions and reconnects don't ask again.
- Host keys are checked against
~/.ssh/known_hosts. Unknown keys are confirmed once and remembered by the extension.
Usage
- Open the Agentless SSH view in the activity bar.
- Click a host under Hosts (or use Connect… and type
user@host:port).
- Browse the session under Sessions. Click a file to edit it, then press Cmd/Ctrl+S to save it to the server.
Session actions (inline icons and right-click):
| Action |
What it does |
| Switch User… |
sudo to root or another user, su (with the target user's password), sudo su, or your own command exactly as you type it in a terminal, e.g. sudo -u librenms -i or sudo su - postgres |
| Back to Login User |
Return to plain SFTP as the login user |
| Change Folder… |
Type any path (/etc/nginx, ~/app, ../logs) or pick a recent one |
| Go to Parent / Home |
Quick navigation. Right-click a folder and choose Open as Root Folder to make it the session's root |
| Open Terminal |
Shell on the same connection, as the session's current user, in the selected folder |
| New Session |
Another independent session to the same host |
The status bar shows which user the active remote file will be saved as. Click it to switch user.
Upload, download, drag & drop
|
How |
| Upload |
Drag files or folders from Finder / Explorer / VS Code's Explorer (or an editor tab) onto a folder in Sessions. Or right-click a folder → Upload… |
| Download |
Right-click → Download…. One file asks where to save it. Several items or folders go into a folder you pick |
| Move on the server |
Drag items onto another folder of the same session (asks first) |
| Copy between servers |
Drag items from one session onto a folder of another session. Files are written as that session's user, so you can copy into /root of a sudo session |
| Open |
Drag a remote file onto the editor area |
Select several items with Cmd/Ctrl or Shift; Delete, Download and Copy Path work on all of them. Existing files trigger a Replace / Skip prompt. Files you can't read (or whose names Windows doesn't allow) are skipped and listed at the end, and the rest is still copied. Symlinked folders are not followed.
Dragging files out of the tree to Finder / Explorer / the desktop is not possible: VS Code doesn't let extensions start drags to the operating system. Use Download… instead.
If you get Permission denied, use Switch User…. Open editors keep working and the next save goes through as the new user.
How switching user works
With Your own command… Agentless SSH runs the command you'd type in a terminal (for example sudo -u librenms -i), answers its password prompt with what you type in VS Code, and then starts its helper inside the shell that opens. This also works when the user's login profile starts yet another shell.
Agentless SSH runs sudo -u <user> /bin/sh (or su -s /bin/sh <user>) on a pseudo-terminal of the existing connection. If a password is asked, you type it in VS Code's input box. The terminal is then switched to raw mode, and file operations are done with standard tools (stat, base64, dd, cat, mkdir, mv, rm). These are present on GNU/Linux, BusyBox and BSD/macOS systems. A command takes well under a millisecond on top of the network round trip.
Files larger than 32 KB are saved through a faster path. The login user uploads them over SFTP into /tmp/.agentless-ssh-<random> (mode 0711, so other users can't list it), under a random name. The other user's shell then copies the data into place with cat, and the temp file is deleted right away. Writing in place keeps the owner and permissions of the existing file.
Windows, macOS, Linux
The extension is pure JavaScript (no native modules), so it runs the same on all three.
- SSH config and keys are read from
~/.ssh (%USERPROFILE%\.ssh on Windows).
- ssh-agent:
IdentityAgent from the config, otherwise SSH_AUTH_SOCK. On Windows without SSH_AUTH_SOCK, the built-in OpenSSH Authentication Agent service is tried first, then Pageant (PuTTY). If no agent is running, Agentless SSH moves on to key files and passwords.
Settings
| Setting |
Default |
|
agentlessSsh.hosts |
[] |
Extra hosts: { "name", "host", "port", "user", "identityFile", "proxyJump", "folder" } |
agentlessSsh.importSshConfig |
true |
Show hosts from the SSH config |
agentlessSsh.sshConfigPath |
"" |
Custom SSH config path |
agentlessSsh.showHiddenFiles |
true |
Show dot files |
Development
npm install
npm run build # bundle to dist/extension.js
npm run typecheck
npx vsce package # -> agentless-ssh-<version>.vsix
Press F5 in VS Code to run the extension in a development host. test/run.sh runs the integration tests against throwaway sshd containers (Docker).