ssh_read_file
Read the contents of a remote file via SSH. Supports text and binary files, returning the data as string or base64.
Instructions
Read the contents of a file on a remote SSH host.
Uses SFTP to transfer the file. Suitable for config files, logs, scripts, etc. For binary files set encoding='raw' to get a base64-encoded string.
Args: alias: Host alias. remote_path: Absolute path of the file to read on the remote host (e.g., '/etc/nginx/nginx.conf'). encoding: Text encoding to decode the file (default 'utf-8'). Use 'raw' to get a base64-encoded string for binary files.
Returns: File contents as text, or base64-encoded bytes for encoding='raw'. Returns an error string on failure.
Examples: - Read nginx config: alias='web', remote_path='/etc/nginx/nginx.conf' - Read /etc/hosts: remote_path='/etc/hosts' - Read binary file: remote_path='/usr/bin/ls', encoding='raw'
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alias | Yes | ||
| remote_path | Yes | ||
| encoding | No | utf-8 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |