To disable root SSH access without locking yourself out, first create and test a separate administrator account with working SSH authentication and sudo. Keep the current root or provider-console session open, set the effective OpenSSH directive to PermitRootLogin no, validate the parsed configuration, reload the daemon using your distribution’s documented service name, and test a brand-new administrator connection before ending the old session.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
What disabling root SSH login actually changes
OpenSSH controls whether the account named root may complete an SSH login. The setting is independent of whether root exists locally and does not remove root privileges from the operating system. It changes the remote entry point: administrators connect with an individual account and use sudo for privileged commands.
As an Amazon Associate I earn from qualifying purchases.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Ubuntu and Debian’s OpenSSH documentation describe PermitRootLogin no as a complete prohibition on root login through SSH: “If this option is set to no, root is not allowed to log in.” Red Hat’s hardening guidance likewise recommends authenticating with an individual account and escalating privileges instead of signing in directly as root.
The setting applies to new SSH authentication attempts. It does not turn an already authenticated shell into a non-root shell, which is why the safe procedure deliberately keeps an existing session open until a replacement login has been proven.
#1 Best Overall
- [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
- [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
- [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
- [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
- [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
Choose the right policy value
Do not substitute prohibit-password for a complete ban. That value blocks root password and keyboard-interactive authentication but still permits root authentication with an SSH public key. If the objective is that root cannot log in over SSH by any method, the target value is no.
| Directive value | Can root authenticate through SSH? | Can a root public key still work? | Password and keyboard-interactive methods | Typical fit for routine administration |
|---|---|---|---|---|
yes |
Yes | Yes | Allowed when other authentication settings permit them | Direct root administration; not the individual-account model described by hardening guidance |
prohibit-password |
Yes, with non-password methods | Yes | Disabled for root | Partial reduction only; not a root-login ban |
forced-commands-only |
Only in the restricted public-key case | Only keys carrying a forced command | Not used to provide ordinary root access | Narrow automation scenarios, not normal administrator login |
no |
No | No | Not applicable because root SSH login is denied | Recommended when you want individual accounts plus sudo |
The meanings above come from the OpenSSH sshd_config(5) documentation used by Ubuntu and Debian. Authentication controls such as password authentication, key authentication, and network access rules are separate settings; changing PermitRootLogin does not configure those controls.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePre-flight checks that prevent lockout
Complete these checks before editing any SSH configuration. A root shell that is currently open is not proof that a new administrator login will work.
- Use an individual account. Pick the account that will replace root for routine administration. Do not rely on an account that exists only in a provisioning script or on a key you have not tested.
- Verify authentication from another terminal. Open a separate local terminal and connect to the VPS as the replacement user with the same key, certificate, or other approved method you intend to use after the change.
- Verify privilege escalation. In that new session, run
sudo -vand then a harmless identity check such assudo id. The command must succeed using the account’s approved sudo policy. - Confirm the target host and port. Check the VPS address, SSH port, username, and key file in the second terminal. A successful connection to a different machine does not protect this VPS.
- Keep recovery access available. Make sure the provider’s web console, serial console, rescue environment, or another documented out-of-band route is usable. If a syntax or access mistake prevents SSH connections, that route is what lets you repair the host.
- Keep the current root or console shell open. Do not close it, log out, or terminate its terminal until the post-change tests pass.
Find the configuration that sshd really parses
OpenSSH normally reads /etc/ssh/sshd_config, unless the daemon was started with an alternate configuration file. Distributions can also enable configuration drop-ins. A line in the main file may therefore not be the line supplying the effective value on your VPS.
Rank #2
- 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
- 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
- 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
- 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
- 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
Inspect the main file and enabled drop-ins
- From the still-open privileged session, list the SSH server configuration and any distribution-specific include directory. Read the comments in the file to identify enabled drop-ins rather than assuming every file in a directory is active.
- Search the main file and enabled drop-ins for every occurrence of
PermitRootLogin. Record the file and line that currently controls the setting, and look for conflicting entries. - Check whether your provider or cloud-init process manages those files. An automated update can restore a previous value after you edit it manually, so record the source of the winning directive.
The goal is not merely to place a line somewhere in /etc/ssh/sshd_config; it is to confirm the value returned by the daemon’s effective-configuration check. Distribution packaging and drop-in layouts differ, so follow the target VPS image’s documented include paths.
Set PermitRootLogin no safely
Back up before editing
Make a dated copy of the active server configuration, using a location readable from the recovery session. Preserve ownership and permissions where your operating system’s backup procedure requires it. The backup gives you a known reference if the edit must be reverted from the provider console.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Edit the effective file
Use a root-capable editor such as sudoedit from the replacement account, or edit from the existing root shell. Add or change the effective directive so it is exactly:
PermitRootLogin no
Remove or correct competing active entries according to the distribution’s configuration rules, then save the file. Do not change unrelated authentication settings in the same maintenance window. Keeping the change narrowly scoped makes validation and recovery easier.
Rank #3
- [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
- [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
- [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
- [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
- [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
Check the edited text
- The directive name is spelled
PermitRootLogin, with no extra punctuation. - The value is the unquoted word
no. - The line is not accidentally commented out with
#. - The file you edited is actually included by the running SSH daemon.
- No enabled drop-in supplies a different effective value.
Validate before reloading
Validation has two separate purposes: detect syntax errors and prove what value the daemon will use. Perform both with the SSH configuration and binary used by your VPS.
Run a syntax check
Use the OpenSSH server’s supported test mode from a privileged shell. On builds that provide it, the conventional command is:
sudo sshd -t
A successful syntax test normally produces no output and returns a success status. If it reports a file, line, permission, or option error, do not reload; correct the problem while the current session and recovery console remain available. If your distribution supplies a wrapper or a different documented validation command, use that command instead.
Inspect the effective value
The CIS benchmark demonstrates using sshd -T to inspect parsed settings. Run:
Rank #4
- Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
- Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
- All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
- Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
- Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
sudo sshd -T | grep -i '^permitrootlogin'
The result must show:
permitrootlogin no
If the output shows yes, prohibit-password, or no matching line, stop. Recheck the active configuration file, include directives, alternate daemon configuration, and conflicting entries. Editing a file that the running daemon does not parse will not change access policy.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsReload the daemon, then test a new connection
Use the distribution’s service name
Reload the SSH service with the service-management command documented for the VPS distribution. The unit name varies between distributions and images; it may be represented as ssh or sshd, so verify rather than guessing. A reload applies the configuration without intentionally stopping the service, but a failed reload must still be treated as an incident until the daemon’s status and logs are checked.
Do not close the root shell during or after the reload. If the service manager reports an error, use the open shell or provider console to read the reported configuration line, repair it, and rerun validation before attempting another reload.
Test the replacement administrator from a separate terminal
- Start a completely new SSH connection to the VPS as the replacement administrator. Do not reuse an existing multiplexed session without confirming that it creates a fresh authentication attempt.
- Confirm the account is the intended user with
idor your normal identity command. - Run
sudo -vand a harmless privileged command such assudo id. Confirm that the account can still escalate. - Attempt a new connection as
rootusing the method you previously used. The attempt should be rejected. A key-based root attempt must also fail; otherwise the effective value is notnoor another access path is being used. - Only after all checks succeed should you close the original root session.
Test from a separate terminal or network path because an already authenticated shell can conceal a broken account, key, port, firewall rule, or daemon reload.
Best Value
What to do if you are locked out
The old root shell is still open
Leave it open and undo only the problematic change. First run the syntax and effective-value checks again. If the replacement account cannot authenticate, restore the last known-good configuration from your backup, validate it, reload the daemon, and investigate the account’s key, username, permissions, or sudo policy before retrying.
Free tools Windows power users keep installed
One-click scans. No signup required.
SSH is unavailable but provider console access works
Use the console or serial session to log in with the provider-approved account, inspect the SSH daemon status and configuration error, and restore a valid configuration. Re-run the syntax check and effective-value check before reloading. The exact console menu, rescue mode, and service command are provider- and distribution-specific; follow that platform’s recovery documentation.
No SSH or out-of-band access works
Contact the VPS provider’s recovery process rather than repeatedly changing files blindly. You may need a rescue environment or attached-disk repair. Once access is restored, document why the replacement login failed and repeat the procedure with a tested key and console path.
Common mistakes and their symptoms
| Symptom | Likely cause | Safe response |
|---|---|---|
| Root key login still succeeds | prohibit-password remains effective, or a drop-in overrides the edit |
Run sshd -T, locate the winning file, set the effective value to no, validate, and reload |
| Reload fails immediately | Syntax error, invalid option, wrong file, or permissions problem | Keep the current session, read the service error, fix the named issue, and rerun validation |
| New administrator login fails | Untested key, wrong username, wrong port, account restriction, or missing sudo authorization | Use the open root or console session to correct the account and test a fresh connection before disabling root again |
| Setting appears to revert later | Cloud-init, image management, or a package update rewrote an included file | Record the file supplying the effective directive, inspect automation, and recheck after updates |
| Existing root shell still works | The shell was authenticated before the policy change | Do not treat it as proof of continued root access; test a new root connection separately |
Distribution and automation qualifications
This procedure applies to OpenSSH on Linux VPS distributions represented by Ubuntu, Debian, and Red Hat documentation. The directive semantics are consistent, but exact service commands, configuration drop-in paths, cloud-init behavior, and provider-console features vary by distribution and image.
Record the distribution and version, the configuration file that supplied the winning directive, the validation output, and the date of the change. Recheck the effective value after package upgrades, image changes, or cloud-init runs. A written record prevents a later administrator from assuming that the main file alone represents the running policy.
Quick Recap
Final verification checklist
- A separate administrator account exists and has a tested SSH authentication method.
- That account successfully runs
sudo -vand a harmless privileged command. - A root shell or out-of-band console remains available during the change.
- The main configuration and enabled drop-ins have been inspected.
- The effective directive is
PermitRootLogin no. - The daemon’s syntax check succeeds.
- The parsed configuration check reports
permitrootlogin no. - The SSH service reload succeeds using the distribution’s documented service name.
- A new administrator connection succeeds.
- A new root SSH attempt is rejected, including a public-key attempt.
- The final file, validation result, distribution version, and change date are recorded.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




