From fd5c876d7d2428c226710e9334d2f2602c43753d Mon Sep 17 00:00:00 2001 From: zaphod-black Date: Sat, 1 Nov 2025 16:58:30 -0500 Subject: [PATCH] Fix authentication test to use correct PBS client commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The issue was using 'proxmox-backup-client status' which doesn't exist. Changes: - Use 'proxmox-backup-client login' for authentication testing (This is the proper command to test credentials) - Use 'proxmox-backup-client list' instead of 'snapshot list' (Simpler command to verify datastore access) - Reduced timeouts from 30s to 15s (these commands are faster) - Added debug output showing the repository string being used - Improved error message display from PBS client This should resolve authentication timeouts and actually show real error messages when credentials are invalid. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- pbs-client-installer.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/pbs-client-installer.sh b/pbs-client-installer.sh index 3fdcd94..7f81d29 100755 --- a/pbs-client-installer.sh +++ b/pbs-client-installer.sh @@ -516,12 +516,12 @@ test_connection() { fi log "Server is reachable" - # Step 2: Test authentication with a simple command + # Step 2: Test authentication info "Step 2/3: Testing authentication..." - # Try to get datastore status (simpler than listing snapshots) + # Use the 'login' command which tests authentication and stores a ticket local test_output - if test_output=$(timeout 30 proxmox-backup-client status --output-format json 2>&1); then + if test_output=$(timeout 15 proxmox-backup-client login 2>&1); then log "Authentication successful" else local exit_code=$? @@ -533,7 +533,11 @@ test_connection() { else error "Authentication failed" # Show the actual error from PBS client - echo "$test_output" | grep -i "error\|permission\|authentication\|denied" | head -3 + if echo "$test_output" | grep -q "error\|Error"; then + echo + echo "$test_output" | grep -i "error" | head -5 + echo + fi fi error "Possible issues:" @@ -547,18 +551,20 @@ test_connection() { echo " 2. Check datastore name: ${PBS_DATASTORE}" echo " 3. Verify user has backup permissions" echo " 4. For API tokens, format is: username@realm!tokenname" + echo + info "Debug info:" + echo " Repository: ${PBS_REPOSITORY}" return 1 fi - # Step 3: Verify datastore access + # Step 3: Verify datastore access by listing backup groups info "Step 3/3: Verifying datastore access..." - if timeout 30 proxmox-backup-client snapshot list &>/dev/null; then + if timeout 15 proxmox-backup-client list 2>/dev/null; then log "Datastore access verified" log "Connection test successful!" return 0 else - warn "Could not list snapshots, but authentication works" - info "This is normal if no backups exist yet" + warn "Could not list backup groups (this is normal if no backups exist yet)" log "Connection test successful!" return 0 fi