Files
Sankofa/docs/proxmox/SSH_WITH_SSHPASS.md
defiQUG 33d50fb91e
Some checks failed
API CI / API Lint (push) Successful in 47s
API CI / API Type Check (push) Failing after 47s
API CI / API Test (push) Successful in 1m0s
API CI / API Build (push) Failing after 50s
API CI / Build Docker Image (push) Has been skipped
Build Crossplane Provider / build (push) Failing after 5m51s
CD Pipeline / Deploy to Staging (push) Failing after 29s
CI Pipeline / Lint and Type Check (push) Failing after 36s
CI Pipeline / Build (push) Has been skipped
CI Pipeline / Test Backend (push) Failing after 1m33s
CI Pipeline / Test Frontend (push) Failing after 30s
CI Pipeline / Security Scan (push) Failing after 1m16s
Crossplane Provider CI / Go Test (push) Failing after 3m23s
Crossplane Provider CI / Go Lint (push) Failing after 7m27s
Crossplane Provider CI / Go Build (push) Failing after 3m27s
Deploy to Staging / Deploy to Staging (push) Failing after 30s
Portal CI / Portal Lint (push) Failing after 21s
Portal CI / Portal Type Check (push) Failing after 21s
Portal CI / Portal Test (push) Failing after 21s
Portal CI / Portal Build (push) Failing after 22s
Test Suite / frontend-tests (push) Failing after 30s
Test Suite / api-tests (push) Failing after 49s
Test Suite / blockchain-tests (push) Failing after 30s
Type Check / type-check (map[directory:. name:root]) (push) Failing after 23s
Type Check / type-check (map[directory:api name:api]) (push) Failing after 21s
Type Check / type-check (map[directory:portal name:portal]) (push) Failing after 19s
Validate Configuration Files / validate (push) Failing after 1m52s
CD Pipeline / Deploy to Production (push) Has been skipped
chore: consolidate local WIP (repo cleanup 20260707)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 09:41:34 -07:00

216 lines
3.6 KiB
Markdown

# SSH Access with sshpass
**Date**: 2025-12-13
**Status**: ✅ **CONFIGURED**
---
## Overview
All SSH scripts have been updated to use `sshpass` with the password from `.env` file (lines 45-46).
---
## Quick Access Scripts
### SSH to ML110-01
```bash
./scripts/ssh-ml110-01.sh
```
### SSH to R630-01
```bash
./scripts/ssh-r630-01.sh
```
### Execute Commands Remotely
```bash
# ML110-01
./scripts/ssh-ml110-01.sh 'pveversion'
./scripts/ssh-ml110-01.sh 'qm list'
./scripts/ssh-ml110-01.sh 'pvesm status'
# R630-01
./scripts/ssh-r630-01.sh 'pveversion'
./scripts/ssh-r630-01.sh 'qm list'
./scripts/ssh-r630-01.sh 'pvesm status'
```
---
## Manual Commands
### Using sshpass Directly
**ML110-01**:
```bash
PROXMOX_PASSWORD=$(sed -n '45,46p' .env | grep PROXMOX_ROOT_PASS | cut -d'=' -f2 | tr -d '"' | tr -d "'")
sshpass -p "$PROXMOX_PASSWORD" ssh root@192.168.11.10
```
**R630-01**:
```bash
PROXMOX_PASSWORD=$(sed -n '45,46p' .env | grep PROXMOX_ROOT_PASS | cut -d'=' -f2 | tr -d '"' | tr -d "'")
sshpass -p "$PROXMOX_PASSWORD" ssh root@192.168.11.11
```
---
## Password Source
The password is automatically loaded from `.env` file:
- **Location**: Lines 45-46
- **Variable**: `PROXMOX_ROOT_PASS`
- **Format**: Automatically extracted and cleaned
---
## Updated Scripts
### 1. `scripts/ssh-proxmox-nodes.sh`
- Displays SSH commands with sshpass
- Shows password status
- Provides verification commands
### 2. `scripts/ssh-ml110-01.sh`
- Quick SSH to ML110-01
- Password loaded automatically
- Supports command execution
### 3. `scripts/ssh-r630-01.sh`
- Quick SSH to R630-01
- Password loaded automatically
- Supports command execution
### 4. `scripts/test-proxmox-connectivity.sh`
- Uses sshpass for SSH tests
- Automatically loads password
- Tests both nodes
---
## Example Usage
### Check Proxmox Version
```bash
# ML110-01
./scripts/ssh-ml110-01.sh 'pveversion'
# R630-01
./scripts/ssh-r630-01.sh 'pveversion'
```
### List VMs
```bash
# ML110-01
./scripts/ssh-ml110-01.sh 'qm list'
# R630-01
./scripts/ssh-r630-01.sh 'qm list'
```
### Check Storage
```bash
# ML110-01
./scripts/ssh-ml110-01.sh 'pvesm status'
# R630-01
./scripts/ssh-r630-01.sh 'pvesm status'
```
### Interactive SSH Session
```bash
# ML110-01
./scripts/ssh-ml110-01.sh
# R630-01
./scripts/ssh-r630-01.sh
```
---
## Security Notes
⚠️ **Important**:
- Password is stored in `.env` file (should be in `.gitignore`)
- `sshpass` passes password via command line (visible in process list)
- For production, consider using SSH keys instead
### Recommended: Setup SSH Keys
```bash
# Generate key
ssh-keygen -t rsa -b 4096 -f ~/.ssh/proxmox_key
# Copy to both nodes
./scripts/ssh-ml110-01.sh 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys' < ~/.ssh/proxmox_key.pub
./scripts/ssh-r630-01.sh 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys' < ~/.ssh/proxmox_key.pub
# Then use key-based auth
ssh -i ~/.ssh/proxmox_key root@192.168.11.10
ssh -i ~/.ssh/proxmox_key root@192.168.11.11
```
---
## Troubleshooting
### sshpass Not Installed
```bash
# Ubuntu/Debian
sudo apt-get install sshpass
# RHEL/CentOS
sudo yum install sshpass
```
### Password Not Found
Check `.env` file:
```bash
sed -n '45,46p' .env
```
Should show:
```
PROXMOX_ROOT_PASS=L@KERS2010
```
### Connection Issues
Test connectivity:
```bash
ping -c 3 192.168.11.10
ping -c 3 192.168.11.11
```
Test SSH manually:
```bash
ssh -v root@192.168.11.10
```
---
## Conclusion
**All scripts updated to use sshpass**
- Password automatically loaded from `.env`
- Quick access scripts available
- Connectivity tests use sshpass
- Ready for automated operations
---
**Last Updated**: 2025-12-13
**Status**: ✅ **CONFIGURED**