# Enable Root SSH Login for Container VMID 5000 **Last Updated:** 2026-01-31 **Document Version:** 1.0 **Status:** Active Documentation --- **Status**: Password already set to `L@kers2010` **Issue**: Root SSH login is disabled **Solution**: Enable root SSH in container --- ## Quick Commands Since you can access the LXC container, run these commands inside the container: ### Method 1: Via Container Console/Shell ```bash # Access container (you mentioned you can access it now) pct enter 5000 # Or via console UI # Inside container, run: sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config sudo sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config sudo sed -i 's/#PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config sudo sed -i 's/PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config # If PermitRootLogin doesn't exist, add it if ! grep -q "^PermitRootLogin" /etc/ssh/sshd_config; then echo "PermitRootLogin yes" | sudo tee -a /etc/ssh/sshd_config fi # Restart SSH service sudo systemctl restart sshd # Exit container exit ``` ### Method 2: Via pct exec (One-liner) From pve2 node or Proxmox host: ```bash # Enable root SSH pct exec 5000 -- bash -c ' sudo sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/" /etc/ssh/sshd_config sudo sed -i "s/PermitRootLogin prohibit-password/PermitRootLogin yes/" /etc/ssh/sshd_config sudo sed -i "s/#PermitRootLogin no/PermitRootLogin yes/" /etc/ssh/sshd_config sudo sed -i "s/PermitRootLogin no/PermitRootLogin yes/" /etc/ssh/sshd_config if ! grep -q "^PermitRootLogin" /etc/ssh/sshd_config; then echo "PermitRootLogin yes" | sudo tee -a /etc/ssh/sshd_config fi sudo systemctl restart sshd echo "Root SSH enabled" ' ``` --- ## Complete Step-by-Step ### Step 1: Access Container ```bash # From pve2 node pct enter 5000 ``` ### Step 2: Backup SSH Config ```bash sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.backup ``` ### Step 3: Edit SSH Config ```bash # View current config sudo grep PermitRootLogin /etc/ssh/sshd_config # Enable root login sudo sed -i 's/.*PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config # Or use nano/vi sudo nano /etc/ssh/sshd_config # Find PermitRootLogin line and change to: # PermitRootLogin yes ``` ### Step 4: Verify Configuration ```bash # Check the setting sudo grep PermitRootLogin /etc/ssh/sshd_config # Should show: PermitRootLogin yes ``` ### Step 5: Restart SSH Service ```bash sudo systemctl restart sshd # Or if systemctl doesn't work: sudo service ssh restart ``` ### Step 6: Exit Container ```bash exit ``` ### Step 7: Test SSH Access ```bash # Try SSH to container ssh root@192.168.11.140 # Password: L@kers2010 ``` --- ## Alternative: If Container Uses Different SSH Config Location Some Ubuntu containers may use different paths: ```bash # Check which SSH config exists ls -la /etc/ssh/sshd_config ls -la /etc/ssh/sshd_config.d/ # If using sshd_config.d, create override echo "PermitRootLogin yes" | sudo tee /etc/ssh/sshd_config.d/99-root-login.conf sudo systemctl restart sshd ``` --- ## Security Note ⚠️ **Security Warning**: Enabling root SSH login reduces security. Consider: 1. Use key-based authentication instead of password 2. Change default SSH port 3. Use fail2ban to prevent brute force attacks 4. Restrict root SSH to specific IPs ### Recommended: Use SSH Keys Instead ```bash # On your local machine, generate key (if you don't have one) ssh-keygen -t ed25519 -C "your_email@example.com" # Copy public key to container ssh-copy-id root@192.168.11.140 # Then disable password authentication sudo sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config sudo systemctl restart sshd ``` --- ## Verification After enabling root SSH: ```bash # Test SSH access ssh root@192.168.11.140 # Should prompt for password: L@kers2010 ``` If SSH still doesn't work: 1. Check SSH service is running: `sudo systemctl status sshd` 2. Check firewall: `sudo ufw status` 3. Verify IP: `ip addr show eth0` 4. Check SSH logs: `sudo tail -f /var/log/auth.log` --- ## Quick Script Run this script to enable root SSH: ```bash #!/bin/bash # Enable root SSH for container VMID 5000 pct exec 5000 -- bash -c ' sudo sed -i "s/.*PermitRootLogin.*/PermitRootLogin yes/" /etc/ssh/sshd_config if ! grep -q "^PermitRootLogin" /etc/ssh/sshd_config; then echo "PermitRootLogin yes" | sudo tee -a /etc/ssh/sshd_config fi sudo systemctl restart sshd echo "✅ Root SSH enabled" ' ``` --- **Last Updated**: $(date)