Edit a remote file
3 minute read · FTP / SFTP
For a small server-file change, open the file, edit it locally through the supported workflow and let the tracked upload return the saved change.
- Edit and upload deliberately
- Understand the properties view
- Use agent file tools with a clear scope
- Follow a remote edit all the way back
Edit and upload deliberately
Navigate to the correct server and remote file, then use the supported local-open/edit workflow. Confirm the file path before saving changes. A local save is only one step: inspect the tracked upload state and any error before assuming the remote service received the new content.
If the network drops after editing, preserve the local changed file. Reconnect and compare the remote version before retrying an upload that could overwrite someone else's work. Opening a file to read it is different from authorizing the agent to replace it.
For a configuration change, make the smallest intended edit, upload it and verify the behavior through the appropriate application check. Some services require a separate reload or restart; a successful upload alone does not authorize or perform that operation.
Understand the properties view
Inspect type, size, timestamps, owner/group and permissions where the server provides them. Numeric and rwx permission controls describe the remote access bits; special bits need their own purpose. Do not use broad write permissions as a generic fix for an application error.
Ask which account should read or write the file, then choose the narrow change appropriate to that server. A permissions error may come from the parent directory, ownership or server policy, not only the file's displayed mode.
Use agent file tools with a clear scope
The FTP/SFTP MCP tools can inspect directories, read bounded text/base64 content and perform declared writes, moves, chmod and deletions. Specify the saved connection ID and canonical target path. A directory listing does not authorize recursively deleting its contents. Keep credentials out of tool results and review file content for private information before sharing it in chat. See SSH host identity when SFTP uses a saved SSH host.
Follow a remote edit all the way back
Open a small remote text file through the supported local-open action. Inspect the filename and remote location, make one intended edit, save and follow the tracked upload result. Reopen or read the remote file after upload to confirm it contains the saved text. An editor showing your local changes is not proof the remote server accepted them.
Before a permissions change, inspect type, owner/group and numeric or rwx permissions. Directories need traversal permissions as well as ordinary file access; setting broad write access everywhere is rarely a good correction. Special bits and ownership behavior depend on the server and protocol. Review the exact target, recursive scope and current state before applying an authorized change.
If upload fails, retain the local edit and inspect authentication, destination permissions, connection state and disk-space errors. Do not discard the only modified copy to make the tab appear saved. When asking an agent to help, name the saved connection and path, then separate read-only inspection from the approved write.