HostingB2B » How to » VPS Hosting » How to Enable Root Login via SSH on Ubuntu

How to Enable Root Login via SSH on Ubuntu

Summarize with:
Share:

Strategic Security Context

Direct root SSH access is a calculated risk in 2026. For iGaming platforms and Fintech applications—where PCI-DSS compliance and data integrity are mandatory—root login should only be temporary, used during initial provisioning of your VPS Hosting, migration, or system tuning. Once the heavy lifting is done, the best practice is to lock it down. Enable Root Login via SSH should only be permitted for a limited time during initial deployment or critical maintenance, with strict monitoring and access controls in place. After configuration is complete, it is strongly recommended to disable or restrict Enable Root Login via SSH in favor of key-based authentication and non-root administrative access.

Before enabling, implement these hardening measures:

Related ReadInstalling XRDP on Debian/Ubuntu VPS: Connect via Remote Desktop
  • SSH Key Authentication: Use RSA 4096 or Ed25519 keys immediately.
  • Port Obfuscation: Move SSH from default port 22 to a high-range port to avoid the majority of automated brute-force attacks.
  • Network Access Control: Restrict access via IP whitelisting (UFW or hardware firewalls) or secure VPN tunnels.

Implementation Workflow (Ubuntu 22.04 / 24.04 / 26.04 LTS)

Initialize Root Credential

By default, root is locked. Assign a strong password (≥32 characters):

sudo passwd root 

Modify SSH Daemon Configuration

sudo nano / etc / ssh / sshd_config

Set the Access Level

Locate the PermitRootLogin line. Choose one of the following options based on your security needs:

Option A: Enhanced Security (Recommended) Allows Root login only via SSH keys, blocking all password attempts.

PermitRootLogin prohibit-password

Option B: Full Access (Less Secure) Allows Root login using both SSH keys and standard passwords.

PermitRootLogin yes

Save and Restart

  • Press Ctrl + O, then Enter to save. Press Ctrl + X to exit.
  • Crucial: Restart the SSH service to apply change
sudo systemctl restart ssh

Utility in High-Performance Infrastructure

Root access is often required for:

  • Seamless Data Migration: Move multi-terabyte iGaming databases or transaction logs via rsync while preserving permissions.
  • Kernel-Level Tuning: Apply sysctl optimizations and low-latency network stack configurations for Fintech workloads.
  • Legacy Integration: Execute proprietary binaries or bind sockets that require root privileges during initial setup.

Security Mandates & Best Practices

Even temporary root access increases attack surface, so enforce:

  • Edge Security: L3–L7 DDoS mitigation via Anycast and scrubbing centers.
  • Application Protection: WAF with SQLi, XSS, CSRF, and API abuse prevention.
  • Infrastructure Isolation: Bare Metal, network segmentation, RBAC, strict firewall rules.
  • Data Compliance: Encrypt data in transit and at rest, maintain audit logs, align with PCI DSS & ISO/IEC 27001.

Key Recommendation: After provisioning or migration, revert PermitRootLogin to prohibit-password and enforce key-based access.

Key Takeaways

  • Root SSH is temporary and should never remain enabled in production.
  • Always combine cryptographic keys, firewall rules, and port obfuscation.
  • Use root for data migrations, kernel tuning, or legacy system setups.
  • Audit and log all actions to remain compliant with iGaming and Fintech regulations.
© 2026 All Rights Reserved. HostingB2B

Hosting B2B LTD is a Company registered in Cyprus with Company number HE410139 and VAT CY10410139C

Contact Info

© 2026 All Rights Reserved. HostingB2B