ssh_write_file
Write text or binary content to a file on a remote SSH host using SFTP. Missing parent directories are created automatically.
Instructions
Write content to a file on a remote SSH host (create or overwrite).
Uses SFTP to transfer the content. Missing parent directories are created automatically. For binary content, base64-encode it and set encoding='base64'.
Args: alias: Host alias. remote_path: Absolute destination path on the remote host. content: Text to write. For binary content, encode as base64 and set encoding='base64'. encoding: 'utf-8' to write the content as text (default), 'base64' to decode first.
Returns: Success message with byte count, or an error description.
Examples: - Write a cron job: remote_path='/etc/cron.d/myjob', content='...' - Deploy a config: remote_path='/etc/myapp/config.yaml', content='...' - Write a script: remote_path='/usr/local/bin/deploy.sh', content='...'
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alias | Yes | ||
| remote_path | Yes | ||
| content | Yes | ||
| encoding | No | utf-8 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |