ssh_connect
Authenticate and create an SSH session to a remote server, enabling command execution, file transfer, and directory listing via the returned session ID.
Instructions
Establish an SSH connection to a remote server.
This tool creates a new SSH session that can be used for subsequent operations like command execution, file upload/download, and directory listing.
Args: params (ConnectInput): Validated input parameters containing: - host (str): Remote server hostname or IP address (e.g., "192.168.1.100", "server.example.com") - port (int): SSH port number, default 22, range 1-65535 - username (str): SSH username for authentication - password (Optional[str]): Password for authentication (alternative to private_key_path) - private_key_path (Optional[str]): Path to SSH private key file (alternative to password) - private_key_password (Optional[str]): Password for encrypted private key - timeout (int): Connection timeout in seconds, default 30, range 1-300 - session_id (Optional[str]): Session identifier, auto-generated if omitted
Returns: str: Session ID for the established connection or error message
Examples: - Use when: "Connect to server 192.168.1.100 with username admin" -> params with host="192.168.1.100", username="admin" - Use when: "Connect using SSH key" -> params with private_key_path="/path/to/key" - Don't use when: Session already exists (use ssh_status to check) - Don't use when: Need to execute multiple commands to different servers (create separate sessions)
Error Handling: - Returns error if authentication fails (check credentials) - Returns error if host is unreachable (check network) - Returns error if port is invalid or service not running
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |