Introduction
VPS SSH login fails when public key not in authorized_keys or permissions incorrect. This guide provides step-by-step diagnosis and resolution.
Symptoms
Typical error output:
bash
Permission denied (publickey)
Server refused our key
Authentication failed: publickey not in authorized_keys or permissions incorrectCommon Causes
- 1.Account quota or resource limit exceeded
- 2.Permission or authentication configuration issue
- 3.Service not running or configuration error
- 4.SSL certificate or domain validation issue
Step-by-Step Fix
Step 1: Check Current State
bash
# Check service status
systemctl status apache2 nginx php-fpm
# View error logs
tail -f /var/log/error.log
# Check disk usage
df -hStep 2: Identify Root Cause
bash
# Check account limits
# Hosting panel > Account > Resource Usage
# View service logs
tail -f /var/log/apache2/error.log
# Check disk and memory
free -m && df -hStep 3: Apply Primary Fix
```bash # Primary fix: Check limits and restart # Check account quotas in hosting panel # Verify disk usage df -h
# Restart failed service systemctl restart apache2
# Clear logs if disk full rm -f /var/log/*.log.old ```
Step 4: Apply Alternative Fix
bash
# Alternative: Contact support
# Check hosting panel > Account > Limits
# Submit support ticket with:
# - Error message
# - Timestamp
# - Steps attemptedStep 5: Verify the Fix
bash
curl -I https://yourdomain.com
# Should return 200 OK
df -h
# Check disk space is availableCommon Pitfalls
- Not monitoring account resource usage
- Ignoring disk space warnings
- Using incorrect file permissions
- Not renewing SSL certificates before expiry
Best Practices
- Monitor resource usage in hosting panel
- Set up alerts for quota warnings
- Keep SSL certificates renewed
- Maintain backup of configurations
Related Issues
- Hosting Quota Exceeded
- Permission Denied
- Service Not Running
- SSL Certificate Error