# Remote Server Executor

> Remote SSH server management and code execution with paramiko-based performance optimization

- Skill: `ketomihine/remote-server-executor` (Agent Skill, multi-file: 29 files)
- Install (CLI): `npx skillmds@latest add ketomihine/remote-server-executor`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ketomihine/remote-server-executor/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: Ketomihine (https://skillmd.com/u/ketomihine)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/ketomihine/remote-server-executor

---


# Remote Server Executor Skill

This skill provides comprehensive remote server management capabilities through SSH, with optimized performance and specialized biomedical data analysis features.

## When to Use This Skill

This skill should be used when:
- Executing code on remote servers via SSH
- Managing files and directories on remote systems
- Analyzing large biomedical datasets (Robj, H5AD files) on remote servers
- Performance comparison between different SSH methods
- Managing conda environments and R packages on remote systems

## Core Capabilities

### 1. SSH Connection Management
- High-performance paramiko-based SSH execution
- Connection optimization and error handling
- Multiple authentication methods support

### 2. Remote Code Execution
- Python code execution on remote servers
- R script execution with specified R versions
- Long-running process monitoring
- Real-time output capture

### 3. File Operations
- Remote file system navigation and exploration
- File upload/download operations
- Directory management and analysis
- Large dataset handling (GB-scale files)

### 4. Biomedical Data Analysis
- Seurat object (.robj) analysis and metadata extraction
- Single-cell RNA-seq data processing on remote servers
- H5AD to Seurat conversion capabilities
- Clinical data integration

### 5. Environment Management
- Conda environment setup and management
- R package installation (Seurat, dependencies)
- System resource monitoring

### 6. Performance Analysis
- Paramiko vs sshpass performance comparison
- Token consumption optimization
- Execution time analysis

## Usage Instructions

### Basic SSH Connection
```python
config = {
    'hostname': '10.71.223.201',
    'port': 42022,
    'username': 'lab_zhy',
    'password': '55695543zhu'
}

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(**config)
```

### Remote R Execution
```python
# Execute R code with specific R version
r_code = '''
library(Seurat)
load("data.robj")
print(ls())
'''
stdin, stdout, stderr = ssh.exec_command(f'/usr/bin/R --vanilla << "EOF"\n{r_code}\nEOF')
```

### Large File Analysis
```python
# Analyze 12GB Robj files with extended timeout
analysis_script = '''
cd /media/zhy/zhydata/ncr
load("GSE183852_DCM_Integrated.Robj")
obj <- RefMerge
cat("Cells:", ncol(obj), "Genes:", nrow(obj), "\n")
'''
stdin, stdout, stderr = ssh.exec_command(analysis_script, timeout=1800)
```

### Performance Testing
```python
# Compare paramiko vs sshpass performance
paramiko_time = measure_paramiko_execution(config, test_command)
sshpass_time = measure_sshpass_execution(config, test_command)
```

## File Structure

```
remote-server-executor/
├── SKILL.md                           # This documentation
├── remote-server-executor.py          # Main SSH executor skill
├── ssh_wizard.py                      # SSH configuration wizard
├── performance_comparison.py          # Performance analysis tool
├── token_consumption_test.py          # Token usage analysis
├── test_connection.py                 # Connection testing
├── simple_test.py                     # Basic functionality test
├── install.py                         # Package installation
├── usage_examples.py                  # Usage examples
├── find_ncr_folder.py                 # NCR data discovery
├── check_ncr_folder.py               # NCR folder analysis
├── view_ncr_file.py                  # NCR file inspection
├── check_ncr_directory.py            # Directory content analysis
├── test_r_execution.py               # R execution testing
├── simple_r_test.py                  # Basic R testing
├── install_seurat.py                 # Seurat package installation
├── read_robj_metadata.py             # Robj metadata reading
├── simple_robj_check.py              # Quick Robj validation
├── read_robj_with_timeout.py         # Timeout-enabled Robj reading
├── quick_robj_info.py                # Fast Robj information
├── use_existing_r_script.py          # Existing R script execution
├── analyze_integrated_robj.py        # Integrated Robj analysis
├── simple_integrated_check.py        # Quick integrated analysis
├── direct_robj_analysis.py           # Direct Robj analysis
├── check_metadata_without_seurat.py  # Robj analysis without Seurat
└── analyze_with_conda_r.py           # Conda environment R analysis
```

## Key Features

### Performance Optimization
- Paramiko-based implementation shows 11.5% better performance
- 81.3% reduction in token consumption compared to alternatives
- Optimized connection pooling and reuse

### Biomedical Data Support
- Specialized handling for large single-cell datasets
- Seurat object metadata extraction without full loading
- Integration with conda environments for biomedical packages

### Error Handling
- Comprehensive timeout management for long-running operations
- Graceful handling of connection failures
- Automatic retry mechanisms for unreliable connections

## Configuration

### Server Configuration
Default server configuration for biomedical data analysis:
```python
BIOMEDICAL_SERVER = {
    'hostname': '10.71.223.201',
    'port': 42022,
    'username': 'lab_zhy',
    'password': '55695543zhu'
}
```

### R Environment Configuration
```python
R_EXECUTABLE_PATH = "/usr/bin/R"
CONDA_R_PATH = "/home/zhy/anaconda3/envs/base/bin/R"
OMICVERSE_ENV = "/home/zhy/anaconda3/envs/omicverse"
```

## Integration with Other Skills

### Seurat Single Cell Analysis
- Works seamlessly with `seurat-single-cell` skill for format conversion
- Handles large dataset preprocessing on remote servers
- Supports H5AD to Seurat conversion in conda environments

## References

- Paramiko documentation: https://www.paramiko.org/
- Seurat single-cell analysis: https://satijalab.org/seurat/
- Remote server management best practices
- Biomedical data analysis workflows
